add sourceRef to SearchHit

This commit is contained in:
Shay Banon 2012-03-27 15:37:21 +02:00
parent a76d914cfa
commit 269798c70a
1 changed files with 8 additions and 2 deletions

View File

@ -21,6 +21,7 @@ package org.elasticsearch.search;
import org.apache.lucene.search.Explanation; import org.apache.lucene.search.Explanation;
import org.elasticsearch.ElasticSearchParseException; import org.elasticsearch.ElasticSearchParseException;
import org.elasticsearch.common.BytesHolder;
import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.search.highlight.HighlightField; import org.elasticsearch.search.highlight.HighlightField;
@ -30,7 +31,6 @@ import java.util.Map;
/** /**
* A single search hit. * A single search hit.
* *
*
* @see SearchHits * @see SearchHits
*/ */
public interface SearchHit extends Streamable, ToXContent, Iterable<SearchHitField> { public interface SearchHit extends Streamable, ToXContent, Iterable<SearchHitField> {
@ -86,7 +86,13 @@ public interface SearchHit extends Streamable, ToXContent, Iterable<SearchHitFie
long getVersion(); long getVersion();
/** /**
* The source of the document (can be <tt>null</tt>). * Returns bytes reference, also un compress the source if needed.
*/
BytesHolder sourceRef();
/**
* The source of the document (can be <tt>null</tt>). Note, its a copy of the source
* into a byte array, consider using {@link #sourceRef()} so there won't be a need to copy.
*/ */
byte[] source(); byte[] source();