org.elasticsearch.search.internal
Class InternalSearchHit

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

public class InternalSearchHit
extends 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, String id, String type, byte[] source, Map<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(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.
 String[] getMatchedFilters()
          The set of filter names the query matched.
 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[] matchedFilters()
          The set of filter names the query matched.
 void matchedFilters(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)
           
 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.
 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)
           
 
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,
                         String id,
                         String type,
                         byte[] source,
                         Map<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

version

public void version(long version)

version

public long version()
Description copied from interface: SearchHit
The version of the hit.

Specified by:
version in interface SearchHit

getVersion

public long getVersion()
Description copied from interface: SearchHit
The version of the hit.

Specified by:
getVersion in interface SearchHit

index

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

Specified by:
index in interface SearchHit

getIndex

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

Specified by:
getIndex in interface SearchHit

id

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

Specified by:
id in interface SearchHit

getId

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

Specified by:
getId in interface SearchHit

type

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

Specified by:
type in interface SearchHit

getType

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

Specified by:
getType in interface SearchHit

sourceRef

public BytesReference sourceRef()
Returns bytes reference, also un compress the source if needed.

Specified by:
sourceRef in interface SearchHit

getSourceRef

public BytesReference getSourceRef()
Description copied from interface: SearchHit
Returns bytes reference, also un compress the source if needed.

Specified by:
getSourceRef in interface SearchHit

internalSourceRef

public BytesReference internalSourceRef()
Internal source representation, might be compressed....


source

public byte[] source()
Description copied from interface: SearchHit
The source of the document (can be null). Note, its a copy of the source into a byte array, consider using SearchHit.sourceRef() so there won't be a need to copy.

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 Map<String,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 String sourceAsString()
Description copied from interface: SearchHit
The source of the document as string (can be null).

Specified by:
sourceAsString in interface SearchHit

getSourceAsString

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

Specified by:
getSourceAsString in interface SearchHit

sourceAsMap

public Map<String,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 Iterator<SearchHitField> iterator()
Specified by:
iterator in interface Iterable<SearchHitField>

field

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

Specified by:
field in interface SearchHit

fields

public Map<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

fieldsOrNull

public Map<String,SearchHitField> fieldsOrNull()

getFields

public Map<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(Map<String,SearchHitField> fields)

internalHighlightFields

public Map<String,HighlightField> internalHighlightFields()

highlightFields

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

Specified by:
highlightFields in interface SearchHit

getHighlightFields

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

Specified by:
getHighlightFields in interface SearchHit

highlightFields

public void highlightFields(Map<String,HighlightField> highlightFields)

sortValues

public void sortValues(Object[] sortValues)

sortValues

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

Specified by:
sortValues in interface SearchHit

getSortValues

public 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(String[] matchedFilters)

matchedFilters

public 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 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 XContentBuilder toXContent(XContentBuilder builder,
                                  ToXContent.Params params)
                           throws IOException
Specified by:
toXContent in interface ToXContent
Throws:
IOException

readSearchHit

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

readFrom

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

readFrom

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

writeTo

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

writeTo

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


Copyright © 2009-2012. All Rights Reserved.