public class InternalSearchHit extends Object implements SearchHit
Modifier and Type | Class and Description |
---|---|
static class |
InternalSearchHit.Fields |
static class |
InternalSearchHit.InternalNestedIdentity |
SearchHit.NestedIdentity
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
EMPTY_PARAMS
Constructor and Description |
---|
InternalSearchHit(int nestedTopDocId,
String id,
Text type,
InternalSearchHit.InternalNestedIdentity nestedIdentity,
Map<String,SearchHitField> fields) |
InternalSearchHit(int docId,
String id,
Text type,
Map<String,SearchHitField> fields) |
Modifier and Type | Method and Description |
---|---|
int |
docId() |
org.apache.lucene.search.Explanation |
explanation()
If enabled, the explanation of the search hit.
|
void |
explanation(org.apache.lucene.search.Explanation explanation) |
SearchHitField |
field(String fieldName)
The hit field matching the given field name.
|
Map<String,SearchHitField> |
fields()
A map of hit fields (from field name to hit fields) if additional fields
were required to be loaded.
|
void |
fields(Map<String,SearchHitField> fields) |
Map<String,SearchHitField> |
fieldsOrNull() |
org.apache.lucene.search.Explanation |
getExplanation()
If enabled, the explanation of the search hit.
|
Map<String,SearchHitField> |
getFields()
A map of hit fields (from field name to hit fields) if additional fields
were required to be loaded.
|
Map<String,HighlightField> |
getHighlightFields()
A map of highlighted fields.
|
String |
getId()
The id of the document.
|
String |
getIndex()
The index of the hit.
|
Map<String,SearchHits> |
getInnerHits() |
String[] |
getMatchedQueries()
The set of query and filter names the query matched with.
|
SearchHit.NestedIdentity |
getNestedIdentity()
If this is a nested hit then nested reference information is returned otherwise
null is returned. |
float |
getScore()
The score.
|
SearchShardTarget |
getShard()
The shard of the search hit.
|
Object[] |
getSortValues()
An array of the sort values used.
|
Map<String,Object> |
getSource()
The source of the document as a map (can be null).
|
String |
getSourceAsString()
The source of the document as string (can be null).
|
BytesReference |
getSourceRef()
Returns bytes reference, also un compress the source if needed.
|
String |
getType()
The type of the document.
|
long |
getVersion()
The version of the hit.
|
Map<String,HighlightField> |
highlightFields()
A map of highlighted fields.
|
void |
highlightFields(Map<String,HighlightField> highlightFields) |
String |
id()
The id of the document.
|
String |
index()
The index of the hit.
|
Map<String,HighlightField> |
internalHighlightFields() |
BytesReference |
internalSourceRef()
Internal source representation, might be compressed....
|
boolean |
isSourceEmpty()
Is the source empty (not available) or not.
|
Iterator<SearchHitField> |
iterator() |
String[] |
matchedQueries()
The set of query and filter names the query matched with.
|
void |
matchedQueries(String[] matchedQueries) |
void |
readFrom(StreamInput in) |
void |
readFrom(StreamInput in,
InternalSearchHits.StreamContext context) |
static InternalSearchHit |
readSearchHit(StreamInput in,
InternalSearchHits.StreamContext context) |
float |
score()
The score.
|
void |
score(float score) |
void |
setInnerHits(Map<String,InternalSearchHits> innerHits) |
SearchShardTarget |
shard()
The shard of the search hit.
|
void |
shard(SearchShardTarget target) |
void |
shardTarget(SearchShardTarget shardTarget) |
Object[] |
sortValues()
An array of the sort values used.
|
void |
sortValues(Object[] sortValues) |
byte[] |
source()
The source of the document (can be null).
|
Map<String,Object> |
sourceAsMap()
The source of the document as a map (can be null).
|
String |
sourceAsString()
The source of the document as string (can be null).
|
BytesReference |
sourceRef()
Returns bytes reference, also un compress the source if needed.
|
InternalSearchHit |
sourceRef(BytesReference source)
Sets representation, might be compressed....
|
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params) |
String |
type()
The type of the document.
|
long |
version()
The version of the hit.
|
void |
version(long version) |
void |
writeTo(StreamOutput out) |
void |
writeTo(StreamOutput out,
InternalSearchHits.StreamContext context) |
public InternalSearchHit(int docId, String id, Text type, Map<String,SearchHitField> fields)
public InternalSearchHit(int nestedTopDocId, String id, Text type, InternalSearchHit.InternalNestedIdentity nestedIdentity, Map<String,SearchHitField> fields)
public int docId()
public void shardTarget(SearchShardTarget shardTarget)
public void score(float score)
public float score()
SearchHit
public float getScore()
SearchHit
public void version(long version)
public long version()
SearchHit
public long getVersion()
SearchHit
getVersion
in interface SearchHit
public String getIndex()
SearchHit
public String getType()
SearchHit
public SearchHit.NestedIdentity getNestedIdentity()
SearchHit
null
is returned.getNestedIdentity
in interface SearchHit
public BytesReference sourceRef()
public InternalSearchHit sourceRef(BytesReference source)
public BytesReference getSourceRef()
SearchHit
getSourceRef
in interface SearchHit
public BytesReference internalSourceRef()
public byte[] source()
SearchHit
SearchHit.sourceRef()
so there won't be a need to copy.public boolean isSourceEmpty()
SearchHit
isSourceEmpty
in interface SearchHit
public Map<String,Object> getSource()
SearchHit
public String sourceAsString()
SearchHit
sourceAsString
in interface SearchHit
public String getSourceAsString()
SearchHit
getSourceAsString
in interface SearchHit
public Map<String,Object> sourceAsMap() throws ElasticsearchParseException
SearchHit
sourceAsMap
in interface SearchHit
ElasticsearchParseException
public Iterator<SearchHitField> iterator()
iterator
in interface Iterable<SearchHitField>
public SearchHitField field(String fieldName)
SearchHit
public Map<String,SearchHitField> fields()
SearchHit
public Map<String,SearchHitField> fieldsOrNull()
public Map<String,SearchHitField> getFields()
SearchHit
public void fields(Map<String,SearchHitField> fields)
public Map<String,HighlightField> internalHighlightFields()
public Map<String,HighlightField> highlightFields()
SearchHit
highlightFields
in interface SearchHit
public Map<String,HighlightField> getHighlightFields()
SearchHit
getHighlightFields
in interface SearchHit
public void highlightFields(Map<String,HighlightField> highlightFields)
public void sortValues(Object[] sortValues)
public Object[] sortValues()
SearchHit
sortValues
in interface SearchHit
public Object[] getSortValues()
SearchHit
getSortValues
in interface SearchHit
public org.apache.lucene.search.Explanation explanation()
SearchHit
explanation
in interface SearchHit
public org.apache.lucene.search.Explanation getExplanation()
SearchHit
getExplanation
in interface SearchHit
public void explanation(org.apache.lucene.search.Explanation explanation)
public SearchShardTarget shard()
SearchHit
public SearchShardTarget getShard()
SearchHit
public void shard(SearchShardTarget target)
public void matchedQueries(String[] matchedQueries)
public String[] matchedQueries()
SearchHit
matchedQueries
in interface SearchHit
public String[] getMatchedQueries()
SearchHit
getMatchedQueries
in interface SearchHit
public Map<String,SearchHits> getInnerHits()
getInnerHits
in interface SearchHit
null
if there are nonepublic void setInnerHits(Map<String,InternalSearchHits> innerHits)
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
toXContent
in interface ToXContent
IOException
public static InternalSearchHit readSearchHit(StreamInput in, InternalSearchHits.StreamContext context) throws IOException
IOException
public void readFrom(StreamInput in) throws IOException
readFrom
in interface Streamable
IOException
public void readFrom(StreamInput in, InternalSearchHits.StreamContext context) throws IOException
IOException
public void writeTo(StreamOutput out) throws IOException
writeTo
in interface Streamable
IOException
public void writeTo(StreamOutput out, InternalSearchHits.StreamContext context) throws IOException
IOException
Copyright © 2009–2016. All rights reserved.