org.elasticsearch.search.internal
Class InternalSearchHit

java.lang.Object
  extended by org.elasticsearch.search.internal.InternalSearchHit
All Implemented Interfaces:
java.lang.Iterable<SearchHitField>, Streamable, ToXContent, SearchHit

public class InternalSearchHit
extends java.lang.Object
implements SearchHit


Nested Class Summary
static class InternalSearchHit.Fields
           
 
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.MapParams, ToXContent.Params
 
Field Summary
 
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
 
Constructor Summary
InternalSearchHit(int docId, java.lang.String id, java.lang.String type, byte[] source, java.util.Map<java.lang.String,SearchHitField> fields)
           
 
Method Summary
 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(java.lang.String fieldName)
          The hit field matching the given field name.
 java.util.Map<java.lang.String,SearchHitField> fields()
          A map of hit fields (from field name to hit fields) if additional fields were required to be loaded.
 void fields(java.util.Map<java.lang.String,SearchHitField> fields)
           
 org.apache.lucene.search.Explanation getExplanation()
          If enabled, the explanation of the search hit.
 java.util.Map<java.lang.String,SearchHitField> getFields()
          A map of hit fields (from field name to hit fields) if additional fields were required to be loaded.
 java.util.Map<java.lang.String,HighlightField> getHighlightFields()
          A map of highlighted fields.
 java.lang.String getId()
          The id of the document.
 java.lang.String getIndex()
          The index of the hit.
 java.lang.String[] getMatchedFilters()
          The set of filter names the query matched.
 float getScore()
          The score.
 SearchShardTarget getShard()
          The shard of the search hit.
 java.lang.Object[] getSortValues()
          An array of the sort values used.
 java.util.Map<java.lang.String,java.lang.Object> getSource()
          The source of the document as a map (can be null).
 java.lang.String getType()
          The type of the document.
 java.util.Map<java.lang.String,HighlightField> highlightFields()
          A map of highlighted fields.
 void highlightFields(java.util.Map<java.lang.String,HighlightField> highlightFields)
           
 java.lang.String id()
          The id of the document.
 java.lang.String index()
          The index of the hit.
 boolean isSourceEmpty()
          Is the source empty (not available) or not.
 java.util.Iterator<SearchHitField> iterator()
           
 java.lang.String[] matchedFilters()
          The set of filter names the query matched.
 void matchedFilters(java.lang.String[] matchedFilters)
           
 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)
           
 SearchShardTarget shard()
          The shard of the search hit.
 void shard(SearchShardTarget target)
           
 void shardTarget(SearchShardTarget shardTarget)
           
 java.lang.Object[] sortValues()
          An array of the sort values used.
 void sortValues(java.lang.Object[] sortValues)
           
 byte[] source()
          The source of the document (can be null).
 java.util.Map<java.lang.String,java.lang.Object> sourceAsMap()
          The source of the document as a map (can be null).
 java.lang.String sourceAsString()
          The source of the document as string (can be null).
 void toXContent(XContentBuilder builder, ToXContent.Params params)
           
 java.lang.String type()
          The type of the document.
 void writeTo(StreamOutput out)
           
 void writeTo(StreamOutput out, InternalSearchHits.StreamContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InternalSearchHit

public InternalSearchHit(int docId,
                         java.lang.String id,
                         java.lang.String type,
                         byte[] source,
                         java.util.Map<java.lang.String,SearchHitField> fields)
Method Detail

docId

public int docId()

shardTarget

public void shardTarget(SearchShardTarget shardTarget)

score

public void score(float score)

score

public float score()
Description copied from interface: SearchHit
The score.

Specified by:
score in interface SearchHit

getScore

public float getScore()
Description copied from interface: SearchHit
The score.

Specified by:
getScore in interface SearchHit

index

public java.lang.String index()
Description copied from interface: SearchHit
The index of the hit.

Specified by:
index in interface SearchHit

getIndex

public java.lang.String getIndex()
Description copied from interface: SearchHit
The index of the hit.

Specified by:
getIndex in interface SearchHit

id

public java.lang.String id()
Description copied from interface: SearchHit
The id of the document.

Specified by:
id in interface SearchHit

getId

public java.lang.String getId()
Description copied from interface: SearchHit
The id of the document.

Specified by:
getId in interface SearchHit

type

public java.lang.String type()
Description copied from interface: SearchHit
The type of the document.

Specified by:
type in interface SearchHit

getType

public java.lang.String getType()
Description copied from interface: SearchHit
The type of the document.

Specified by:
getType in interface SearchHit

source

public byte[] source()
Description copied from interface: SearchHit
The source of the document (can be null).

Specified by:
source in interface SearchHit

isSourceEmpty

public boolean isSourceEmpty()
Description copied from interface: SearchHit
Is the source empty (not available) or not.

Specified by:
isSourceEmpty in interface SearchHit

getSource

public java.util.Map<java.lang.String,java.lang.Object> getSource()
Description copied from interface: SearchHit
The source of the document as a map (can be null).

Specified by:
getSource in interface SearchHit

sourceAsString

public java.lang.String sourceAsString()
Description copied from interface: SearchHit
The source of the document as string (can be null).

Specified by:
sourceAsString in interface SearchHit

sourceAsMap

public java.util.Map<java.lang.String,java.lang.Object> sourceAsMap()
                                                             throws ElasticSearchParseException
Description copied from interface: SearchHit
The source of the document as a map (can be null).

Specified by:
sourceAsMap in interface SearchHit
Throws:
ElasticSearchParseException

iterator

public java.util.Iterator<SearchHitField> iterator()
Specified by:
iterator in interface java.lang.Iterable<SearchHitField>

field

public SearchHitField field(java.lang.String fieldName)
Description copied from interface: SearchHit
The hit field matching the given field name.

Specified by:
field in interface SearchHit

fields

public java.util.Map<java.lang.String,SearchHitField> fields()
Description copied from interface: SearchHit
A map of hit fields (from field name to hit fields) if additional fields were required to be loaded.

Specified by:
fields in interface SearchHit

getFields

public java.util.Map<java.lang.String,SearchHitField> getFields()
Description copied from interface: SearchHit
A map of hit fields (from field name to hit fields) if additional fields were required to be loaded.

Specified by:
getFields in interface SearchHit

fields

public void fields(java.util.Map<java.lang.String,SearchHitField> fields)

highlightFields

public java.util.Map<java.lang.String,HighlightField> highlightFields()
Description copied from interface: SearchHit
A map of highlighted fields.

Specified by:
highlightFields in interface SearchHit

getHighlightFields

public java.util.Map<java.lang.String,HighlightField> getHighlightFields()
Description copied from interface: SearchHit
A map of highlighted fields.

Specified by:
getHighlightFields in interface SearchHit

highlightFields

public void highlightFields(java.util.Map<java.lang.String,HighlightField> highlightFields)

sortValues

public void sortValues(java.lang.Object[] sortValues)

sortValues

public java.lang.Object[] sortValues()
Description copied from interface: SearchHit
An array of the sort values used.

Specified by:
sortValues in interface SearchHit

getSortValues

public java.lang.Object[] getSortValues()
Description copied from interface: SearchHit
An array of the sort values used.

Specified by:
getSortValues in interface SearchHit

explanation

public org.apache.lucene.search.Explanation explanation()
Description copied from interface: SearchHit
If enabled, the explanation of the search hit.

Specified by:
explanation in interface SearchHit

getExplanation

public org.apache.lucene.search.Explanation getExplanation()
Description copied from interface: SearchHit
If enabled, the explanation of the search hit.

Specified by:
getExplanation in interface SearchHit

explanation

public void explanation(org.apache.lucene.search.Explanation explanation)

shard

public SearchShardTarget shard()
Description copied from interface: SearchHit
The shard of the search hit.

Specified by:
shard in interface SearchHit

getShard

public SearchShardTarget getShard()
Description copied from interface: SearchHit
The shard of the search hit.

Specified by:
getShard in interface SearchHit

shard

public void shard(SearchShardTarget target)

matchedFilters

public void matchedFilters(java.lang.String[] matchedFilters)

matchedFilters

public java.lang.String[] matchedFilters()
Description copied from interface: SearchHit
The set of filter names the query matched. Mainly makes sense for OR filters.

Specified by:
matchedFilters in interface SearchHit

getMatchedFilters

public java.lang.String[] getMatchedFilters()
Description copied from interface: SearchHit
The set of filter names the query matched. Mainly makes sense for OR filters.

Specified by:
getMatchedFilters in interface SearchHit

toXContent

public void toXContent(XContentBuilder builder,
                       ToXContent.Params params)
                throws java.io.IOException
Specified by:
toXContent in interface ToXContent
Throws:
java.io.IOException

readSearchHit

public static InternalSearchHit readSearchHit(StreamInput in,
                                              InternalSearchHits.StreamContext context)
                                       throws java.io.IOException
Throws:
java.io.IOException

readFrom

public void readFrom(StreamInput in)
              throws java.io.IOException
Specified by:
readFrom in interface Streamable
Throws:
java.io.IOException

readFrom

public void readFrom(StreamInput in,
                     InternalSearchHits.StreamContext context)
              throws java.io.IOException
Throws:
java.io.IOException

writeTo

public void writeTo(StreamOutput out)
             throws java.io.IOException
Specified by:
writeTo in interface Streamable
Throws:
java.io.IOException

writeTo

public void writeTo(StreamOutput out,
                    InternalSearchHits.StreamContext context)
             throws java.io.IOException
Throws:
java.io.IOException