From 269798c70acd7dbf939352d8793b1ef38e4df43a Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Tue, 27 Mar 2012 15:37:21 +0200 Subject: [PATCH] add sourceRef to SearchHit --- src/main/java/org/elasticsearch/search/SearchHit.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/elasticsearch/search/SearchHit.java b/src/main/java/org/elasticsearch/search/SearchHit.java index 05f8fe4489a..89d167b9d02 100644 --- a/src/main/java/org/elasticsearch/search/SearchHit.java +++ b/src/main/java/org/elasticsearch/search/SearchHit.java @@ -21,6 +21,7 @@ package org.elasticsearch.search; import org.apache.lucene.search.Explanation; import org.elasticsearch.ElasticSearchParseException; +import org.elasticsearch.common.BytesHolder; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.search.highlight.HighlightField; @@ -30,7 +31,6 @@ import java.util.Map; /** * A single search hit. * - * * @see SearchHits */ public interface SearchHit extends Streamable, ToXContent, Iterable { @@ -86,7 +86,13 @@ public interface SearchHit extends Streamable, ToXContent, Iterablenull). + * Returns bytes reference, also un compress the source if needed. + */ + BytesHolder sourceRef(); + + /** + * The source of the document (can be null). 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();