Package org.elasticsearch.search.lookup
Interface FieldValues<T>
public interface FieldValues<T>
Represents values for a given document
-
Method Summary
Modifier and TypeMethodDescriptionstatic ValueFetcher
valueFetcher
(FieldValues<?> fieldValues, Function<Object, Object> formatter, SearchExecutionContext context) Creates aValueFetcher
that fetches values from aFieldValues
instancestatic ValueFetcher
valueFetcher
(FieldValues<?> fieldValues, SearchExecutionContext context) Creates aValueFetcher
that fetches values from aFieldValues
instancestatic <T> ValueFetcher
valueListFetcher
(FieldValues<T> fieldValues, Function<List<T>, List<Object>> formatter, SearchExecutionContext context) Creates aValueFetcher
that fetches values from aFieldValues
instancevoid
valuesForDoc
(SearchLookup lookup, org.apache.lucene.index.LeafReaderContext ctx, int doc, Consumer<T> consumer) Loads the values for the given document and passes them to the consumer
-
Method Details
-
valuesForDoc
void valuesForDoc(SearchLookup lookup, org.apache.lucene.index.LeafReaderContext ctx, int doc, Consumer<T> consumer) Loads the values for the given document and passes them to the consumer- Parameters:
lookup
- a search lookup to access values fromctx
- the LeafReaderContext containing the documentdoc
- the docidconsumer
- called with each document value
-
valueFetcher
Creates aValueFetcher
that fetches values from aFieldValues
instance- Parameters:
fieldValues
- the source of the valuescontext
- the search execution context- Returns:
- the value fetcher
-
valueFetcher
static ValueFetcher valueFetcher(FieldValues<?> fieldValues, Function<Object, Object> formatter, SearchExecutionContext context) Creates aValueFetcher
that fetches values from aFieldValues
instance- Parameters:
fieldValues
- the source of the valuesformatter
- a function to format the valuescontext
- the search execution context- Returns:
- the value fetcher
-
valueListFetcher
static <T> ValueFetcher valueListFetcher(FieldValues<T> fieldValues, Function<List<T>, List<Object>> formatter, SearchExecutionContext context) Creates aValueFetcher
that fetches values from aFieldValues
instance- Parameters:
fieldValues
- the source of the valuesformatter
- a function to format the list valuescontext
- the search execution context- Returns:
- the value fetcher
-