public class InternalSearchHit extends Object implements SearchHit
| Modifier and Type | Class and Description |
|---|---|
static class |
InternalSearchHit.Fields |
static class |
InternalSearchHit.InternalNestedIdentity |
SearchHit.NestedIdentityToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsEMPTY_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()
SearchHitpublic float getScore()
SearchHitpublic void version(long version)
public long version()
SearchHitpublic long getVersion()
SearchHitgetVersion in interface SearchHitpublic String getIndex()
SearchHitpublic String getType()
SearchHitpublic SearchHit.NestedIdentity getNestedIdentity()
SearchHitnull is returned.getNestedIdentity in interface SearchHitpublic BytesReference sourceRef()
public InternalSearchHit sourceRef(BytesReference source)
public BytesReference getSourceRef()
SearchHitgetSourceRef in interface SearchHitpublic BytesReference internalSourceRef()
public byte[] source()
SearchHitSearchHit.sourceRef() so there won't be a need to copy.public boolean isSourceEmpty()
SearchHitisSourceEmpty in interface SearchHitpublic Map<String,Object> getSource()
SearchHitpublic String sourceAsString()
SearchHitsourceAsString in interface SearchHitpublic String getSourceAsString()
SearchHitgetSourceAsString in interface SearchHitpublic Map<String,Object> sourceAsMap() throws ElasticsearchParseException
SearchHitsourceAsMap in interface SearchHitElasticsearchParseExceptionpublic Iterator<SearchHitField> iterator()
iterator in interface Iterable<SearchHitField>public SearchHitField field(String fieldName)
SearchHitpublic Map<String,SearchHitField> fields()
SearchHitpublic Map<String,SearchHitField> fieldsOrNull()
public Map<String,SearchHitField> getFields()
SearchHitpublic void fields(Map<String,SearchHitField> fields)
public Map<String,HighlightField> internalHighlightFields()
public Map<String,HighlightField> highlightFields()
SearchHithighlightFields in interface SearchHitpublic Map<String,HighlightField> getHighlightFields()
SearchHitgetHighlightFields in interface SearchHitpublic void highlightFields(Map<String,HighlightField> highlightFields)
public void sortValues(Object[] sortValues)
public Object[] sortValues()
SearchHitsortValues in interface SearchHitpublic Object[] getSortValues()
SearchHitgetSortValues in interface SearchHitpublic org.apache.lucene.search.Explanation explanation()
SearchHitexplanation in interface SearchHitpublic org.apache.lucene.search.Explanation getExplanation()
SearchHitgetExplanation in interface SearchHitpublic void explanation(org.apache.lucene.search.Explanation explanation)
public SearchShardTarget shard()
SearchHitpublic SearchShardTarget getShard()
SearchHitpublic void shard(SearchShardTarget target)
public void matchedQueries(String[] matchedQueries)
public String[] matchedQueries()
SearchHitmatchedQueries in interface SearchHitpublic String[] getMatchedQueries()
SearchHitgetMatchedQueries in interface SearchHitpublic Map<String,SearchHits> getInnerHits()
getInnerHits in interface SearchHitnull if there are nonepublic void setInnerHits(Map<String,InternalSearchHits> innerHits)
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
toXContent in interface ToXContentIOExceptionpublic static InternalSearchHit readSearchHit(StreamInput in, InternalSearchHits.StreamContext context) throws IOException
IOExceptionpublic void readFrom(StreamInput in) throws IOException
readFrom in interface StreamableIOExceptionpublic void readFrom(StreamInput in, InternalSearchHits.StreamContext context) throws IOException
IOExceptionpublic void writeTo(StreamOutput out) throws IOException
writeTo in interface StreamableIOExceptionpublic void writeTo(StreamOutput out, InternalSearchHits.StreamContext context) throws IOException
IOExceptionCopyright © 2009–2017. All rights reserved.