public abstract class SearchContext extends java.lang.Object implements Releasable
Modifier and Type | Class and Description |
---|---|
static class |
SearchContext.Lifetime
The life time of an object that is used during search execution.
|
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_TERMINATE_AFTER |
protected ParseFieldMatcher |
parseFieldMatcher |
Modifier | Constructor and Description |
---|---|
protected |
SearchContext(ParseFieldMatcher parseFieldMatcher) |
Modifier and Type | Method and Description |
---|---|
abstract void |
accessed(long accessTime) |
void |
addReleasable(Releasable releasable,
SearchContext.Lifetime lifetime)
Schedule the release of a resource.
|
abstract void |
addRescore(RescoreSearchContext rescore) |
abstract SearchContextAggregations |
aggregations() |
abstract SearchContext |
aggregations(SearchContextAggregations aggregations) |
abstract org.apache.lucene.search.Query |
aliasFilter() |
abstract AnalysisService |
analysisService() |
abstract BigArrays |
bigArrays() |
abstract BitsetFilterCache |
bitsetFilterCache() |
void |
clearReleasables(SearchContext.Lifetime lifetime) |
void |
close() |
static SearchContext |
current() |
abstract DfsSearchResult |
dfsResult() |
abstract int[] |
docIdsToLoad() |
abstract SearchContext |
docIdsToLoad(int[] docIdsToLoad,
int docsIdsToLoadFrom,
int docsIdsToLoadSize) |
abstract int |
docIdsToLoadFrom() |
abstract int |
docIdsToLoadSize() |
protected abstract void |
doClose() |
abstract void |
emptyFieldNames() |
abstract boolean |
explain() |
abstract void |
explain(boolean explain) |
abstract FetchPhase |
fetchPhase() |
abstract FetchSearchResult |
fetchResult() |
abstract FetchSourceContext |
fetchSourceContext() |
abstract SearchContext |
fetchSourceContext(FetchSourceContext fetchSourceContext) |
abstract IndexFieldDataService |
fieldData() |
abstract java.util.List<java.lang.String> |
fieldNames() |
abstract int |
from() |
abstract SearchContext |
from(int from) |
abstract <SubPhaseContext extends FetchSubPhaseContext> |
getFetchSubPhaseContext(FetchSubPhase.ContextFactory<SubPhaseContext> contextFactory) |
abstract ObjectMapper |
getObjectMapper(java.lang.String name) |
abstract long |
getOriginNanoTime() |
abstract Profilers |
getProfilers()
Return a handle over the profilers for the current search request, or
null if profiling is not enabled. |
abstract QueryShardContext |
getQueryShardContext() |
abstract java.util.List<java.lang.String> |
groupStats() |
abstract void |
groupStats(java.util.List<java.lang.String> groupStats) |
abstract boolean |
hasFetchSourceContext() |
abstract boolean |
hasFieldNames() |
boolean |
hasOnlySuggest() |
abstract boolean |
hasScriptFields() |
abstract SearchContextHighlight |
highlight() |
abstract void |
highlight(SearchContextHighlight highlight) |
abstract long |
id() |
abstract IndexShard |
indexShard() |
InnerHitsContext |
innerHits() |
abstract long |
keepAlive() |
abstract void |
keepAlive(long keepAlive) |
abstract long |
lastAccessTime() |
abstract SearchLookup |
lookup() |
abstract MapperService |
mapperService() |
abstract java.lang.Float |
minimumScore() |
abstract SearchContext |
minimumScore(float minimumScore) |
long |
nowInMillis() |
protected abstract long |
nowInMillisImpl() |
boolean |
nowInMillisUsed() |
abstract int |
numberOfShards() |
abstract PageCacheRecycler |
pageCacheRecycler() |
abstract ParsedQuery |
parsedPostFilter() |
abstract SearchContext |
parsedPostFilter(ParsedQuery postFilter) |
abstract ParsedQuery |
parsedQuery() |
abstract SearchContext |
parsedQuery(ParsedQuery query) |
ParseFieldMatcher |
parseFieldMatcher() |
abstract PercolatorQueryCache |
percolatorQueryCache() |
abstract void |
preProcess()
Should be called before executing the main query and after all other parameters have been set.
|
abstract org.apache.lucene.search.Query |
query()
The query to execute, might be rewritten.
|
abstract float |
queryBoost() |
abstract SearchContext |
queryBoost(float queryBoost) |
abstract java.util.Map<java.lang.Class<?>,org.apache.lucene.search.Collector> |
queryCollectors()
Return a view of the additional query collectors that should be run for this context.
|
abstract QuerySearchResult |
queryResult() |
static void |
removeCurrent() |
abstract ShardSearchRequest |
request() |
abstract java.util.List<RescoreSearchContext> |
rescore() |
void |
resetNowInMillisUsed() |
abstract ScriptFieldsContext |
scriptFields() |
abstract ScriptService |
scriptService() |
abstract ScrollContext |
scrollContext() |
abstract SearchContext |
scrollContext(ScrollContext scroll) |
abstract org.apache.lucene.search.FieldDoc |
searchAfter() |
abstract SearchContext |
searchAfter(org.apache.lucene.search.FieldDoc searchAfter) |
abstract ContextIndexSearcher |
searcher() |
abstract org.apache.lucene.search.Query |
searchFilter(java.lang.String[] types) |
abstract SearchType |
searchType() |
abstract SearchContext |
searchType(SearchType searchType) |
static void |
setCurrent(SearchContext value) |
abstract SearchShardTarget |
shardTarget() |
abstract SimilarityService |
similarityService() |
abstract int |
size() |
abstract SearchContext |
size(int size) |
abstract MappedFieldType |
smartNameFieldType(java.lang.String name)
Looks up the given field, but does not restrict to fields in the types set on this context.
|
abstract org.apache.lucene.search.Sort |
sort() |
abstract SearchContext |
sort(org.apache.lucene.search.Sort sort) |
abstract java.lang.String |
source() |
abstract boolean |
sourceRequested()
A shortcut function to see whether there is a fetchSourceContext and it says the source is requested.
|
abstract SuggestionSearchContext |
suggest() |
abstract void |
suggest(SuggestionSearchContext suggest) |
abstract int |
terminateAfter() |
abstract void |
terminateAfter(int terminateAfter) |
abstract org.apache.lucene.util.Counter |
timeEstimateCounter() |
abstract long |
timeoutInMillis() |
abstract void |
timeoutInMillis(long timeoutInMillis) |
abstract boolean |
trackScores() |
abstract SearchContext |
trackScores(boolean trackScores) |
abstract boolean |
version() |
abstract void |
version(boolean version) |
public static final int DEFAULT_TERMINATE_AFTER
protected final ParseFieldMatcher parseFieldMatcher
protected SearchContext(ParseFieldMatcher parseFieldMatcher)
public static void setCurrent(SearchContext value)
public static void removeCurrent()
public static SearchContext current()
public ParseFieldMatcher parseFieldMatcher()
public final void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface Releasable
protected abstract void doClose()
public abstract void preProcess()
public abstract org.apache.lucene.search.Query searchFilter(java.lang.String[] types)
public abstract long id()
public abstract java.lang.String source()
public abstract ShardSearchRequest request()
public abstract SearchType searchType()
public abstract SearchContext searchType(SearchType searchType)
public abstract SearchShardTarget shardTarget()
public abstract int numberOfShards()
public abstract float queryBoost()
public abstract SearchContext queryBoost(float queryBoost)
public abstract long getOriginNanoTime()
public final long nowInMillis()
public final boolean nowInMillisUsed()
public final void resetNowInMillisUsed()
protected abstract long nowInMillisImpl()
public abstract ScrollContext scrollContext()
public abstract SearchContext scrollContext(ScrollContext scroll)
public abstract SearchContextAggregations aggregations()
public abstract SearchContext aggregations(SearchContextAggregations aggregations)
public abstract <SubPhaseContext extends FetchSubPhaseContext> SubPhaseContext getFetchSubPhaseContext(FetchSubPhase.ContextFactory<SubPhaseContext> contextFactory)
public abstract SearchContextHighlight highlight()
public abstract void highlight(SearchContextHighlight highlight)
public InnerHitsContext innerHits()
public abstract SuggestionSearchContext suggest()
public abstract void suggest(SuggestionSearchContext suggest)
public abstract java.util.List<RescoreSearchContext> rescore()
public abstract void addRescore(RescoreSearchContext rescore)
public abstract boolean hasScriptFields()
public abstract ScriptFieldsContext scriptFields()
public abstract boolean sourceRequested()
public abstract boolean hasFetchSourceContext()
public abstract FetchSourceContext fetchSourceContext()
public abstract SearchContext fetchSourceContext(FetchSourceContext fetchSourceContext)
public abstract ContextIndexSearcher searcher()
public abstract IndexShard indexShard()
public abstract MapperService mapperService()
public abstract AnalysisService analysisService()
public abstract SimilarityService similarityService()
public abstract ScriptService scriptService()
public abstract PageCacheRecycler pageCacheRecycler()
public abstract BigArrays bigArrays()
public abstract BitsetFilterCache bitsetFilterCache()
public abstract IndexFieldDataService fieldData()
public abstract PercolatorQueryCache percolatorQueryCache()
public abstract long timeoutInMillis()
public abstract void timeoutInMillis(long timeoutInMillis)
public abstract int terminateAfter()
public abstract void terminateAfter(int terminateAfter)
public abstract SearchContext minimumScore(float minimumScore)
public abstract java.lang.Float minimumScore()
public abstract SearchContext sort(org.apache.lucene.search.Sort sort)
public abstract org.apache.lucene.search.Sort sort()
public abstract SearchContext trackScores(boolean trackScores)
public abstract boolean trackScores()
public abstract SearchContext searchAfter(org.apache.lucene.search.FieldDoc searchAfter)
public abstract org.apache.lucene.search.FieldDoc searchAfter()
public abstract SearchContext parsedPostFilter(ParsedQuery postFilter)
public abstract ParsedQuery parsedPostFilter()
public abstract org.apache.lucene.search.Query aliasFilter()
public abstract SearchContext parsedQuery(ParsedQuery query)
public abstract ParsedQuery parsedQuery()
public abstract org.apache.lucene.search.Query query()
public abstract int from()
public abstract SearchContext from(int from)
public abstract int size()
public abstract SearchContext size(int size)
public abstract boolean hasFieldNames()
public abstract java.util.List<java.lang.String> fieldNames()
public abstract void emptyFieldNames()
public abstract boolean explain()
public abstract void explain(boolean explain)
@Nullable public abstract java.util.List<java.lang.String> groupStats()
public abstract void groupStats(java.util.List<java.lang.String> groupStats)
public abstract boolean version()
public abstract void version(boolean version)
public abstract int[] docIdsToLoad()
public abstract int docIdsToLoadFrom()
public abstract int docIdsToLoadSize()
public abstract SearchContext docIdsToLoad(int[] docIdsToLoad, int docsIdsToLoadFrom, int docsIdsToLoadSize)
public abstract void accessed(long accessTime)
public abstract long lastAccessTime()
public abstract long keepAlive()
public abstract void keepAlive(long keepAlive)
public abstract SearchLookup lookup()
public abstract DfsSearchResult dfsResult()
public abstract QuerySearchResult queryResult()
public abstract FetchPhase fetchPhase()
public abstract FetchSearchResult fetchResult()
public abstract Profilers getProfilers()
null
if profiling is not enabled.public void addReleasable(Releasable releasable, SearchContext.Lifetime lifetime)
Releasable.close()
will be called on this object
is function of the provided SearchContext.Lifetime
.public void clearReleasables(SearchContext.Lifetime lifetime)
public final boolean hasOnlySuggest()
public abstract MappedFieldType smartNameFieldType(java.lang.String name)
public abstract ObjectMapper getObjectMapper(java.lang.String name)
public abstract org.apache.lucene.util.Counter timeEstimateCounter()
public abstract java.util.Map<java.lang.Class<?>,org.apache.lucene.search.Collector> queryCollectors()
public abstract QueryShardContext getQueryShardContext()