- All Known Implementing Classes:
SearchLookup
public interface SourceProvider
Provides access to the Source of a document
-
Method Summary
Modifier and TypeMethodDescriptionstatic SourceProviderfromLookup(MappingLookup lookup, SourceFilter filter, SourceFieldMetrics metrics) A SourceProvider that delegate loading source to the providedMappingLookup.getSource(org.apache.lucene.index.LeafReaderContext ctx, int doc) Get the Source for the given doc within the given contextdefault SourceProvideroptimizedSourceProvider(SourceFilter sourceFilter) Optionally returns a newSourceProviderthat is more optimized to load source with the provided source filter in mind.
-
Method Details
-
getSource
Get the Source for the given doc within the given context- Throws:
IOException
-
fromLookup
static SourceProvider fromLookup(MappingLookup lookup, SourceFilter filter, SourceFieldMetrics metrics) A SourceProvider that delegate loading source to the providedMappingLookup. The returned SourceProvider is thread-safe across segments, in that it may be safely used by a searcher that searches different segments on different threads, but it is not safe to use this to access documents from the same segment across multiple threads. -
optimizedSourceProvider
Optionally returns a newSourceProviderthat is more optimized to load source with the provided source filter in mind.Currently this is only the case if source mode is synthetic, and only a subset of fields is requested, then only loading source for requested fields is much more efficient.
- Parameters:
sourceFilter- The part of the source the caller is actually interested in.- Returns:
- a new instance if source can be loaded in a more optimal way, otherwise returns this instance.
-