org.elasticsearch.search.internal
Class InternalSearchHit

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

public class InternalSearchHit
extends java.lang.Object
implements SearchHit


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.elasticsearch.util.json.ToJson
ToJson.MapParams, ToJson.Params
 
Field Summary
 
Fields inherited from interface org.elasticsearch.util.json.ToJson
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)
           
 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)
           
 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.
 java.util.Iterator<SearchHitField> iterator()
           
 void readFrom(StreamInput in)
           
 void readFrom(StreamInput in, TIntObjectHashMap<SearchShardTarget> shardLookupMap)
           
static InternalSearchHit readSearchHit(StreamInput in)
           
static InternalSearchHit readSearchHit(StreamInput in, TIntObjectHashMap<SearchShardTarget> shardLookupMap)
           
 SearchShardTarget shard()
          The shard of the search hit.
 void shard(SearchShardTarget target)
           
 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 toJson(JsonBuilder builder, ToJson.Params params)
           
 java.lang.String type()
          The type of the document.
 void writeTo(StreamOutput out)
           
 void writeTo(StreamOutput out, java.util.Map<SearchShardTarget,java.lang.Integer> shardLookupMap)
           
 
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()

index

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

Specified by:
index 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

type

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

Specified by:
type 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

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>

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

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

highlightFields

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

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

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

shard

public void shard(SearchShardTarget target)

toJson

public void toJson(JsonBuilder builder,
                   ToJson.Params params)
            throws java.io.IOException
Specified by:
toJson in interface ToJson
Throws:
java.io.IOException

readSearchHit

public static InternalSearchHit readSearchHit(StreamInput in)
                                       throws java.io.IOException
Throws:
java.io.IOException

readSearchHit

public static InternalSearchHit readSearchHit(StreamInput in,
                                              @Nullable
                                              TIntObjectHashMap<SearchShardTarget> shardLookupMap)
                                       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,
                     @Nullable
                     TIntObjectHashMap<SearchShardTarget> shardLookupMap)
              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,
                    @Nullable
                    java.util.Map<SearchShardTarget,java.lang.Integer> shardLookupMap)
             throws java.io.IOException
Throws:
java.io.IOException