org.elasticsearch.search.internal
Class SearchContext

java.lang.Object
  extended by org.elasticsearch.search.internal.SearchContext
All Implemented Interfaces:
Releasable

public class SearchContext
extends Object
implements Releasable


Constructor Summary
SearchContext(long id, InternalSearchRequest request, SearchShardTarget shardTarget, Engine.Searcher engineSearcher, IndexService indexService, IndexShard indexShard, ScriptService scriptService)
           
 
Method Summary
 void accessed(long accessTime)
           
 void addNestedQuery(String scope, BlockJoinQuery query)
           
 void addScopePhase(ScopePhase scopePhase)
           
 org.apache.lucene.search.Filter aliasFilter()
           
 AnalysisService analysisService()
           
static SearchContext current()
           
 DfsSearchResult dfsResult()
           
 int[] docIdsToLoad()
           
 SearchContext docIdsToLoad(int[] docIdsToLoad, int docsIdsToLoadFrom, int docsIdsToLoadSize)
           
 int docIdsToLoadFrom()
           
 int docIdsToLoadSize()
           
 void emptyFieldNames()
           
 boolean explain()
           
 void explain(boolean explain)
           
 SearchContextFacets facets()
           
 SearchContext facets(SearchContextFacets facets)
           
 FetchSearchResult fetchResult()
           
 FieldDataCache fieldDataCache()
           
 List<String> fieldNames()
           
 FilterCache filterCache()
           
 int from()
           
 SearchContext from(int from)
           
 List<String> groupStats()
           
 void groupStats(List<String> groupStats)
           
 boolean hasFieldNames()
           
 boolean hasPartialFields()
           
 boolean hasScriptFields()
           
 boolean hasTypes()
           
 SearchContextHighlight highlight()
           
 void highlight(SearchContextHighlight highlight)
           
 long id()
           
 IdCache idCache()
           
 IndexShard indexShard()
           
 long keepAlive()
           
 void keepAlive(long keepAlive)
           
 long lastAccessTime()
           
 SearchLookup lookup()
           
 MapperService mapperService()
           
 Float minimumScore()
           
 SearchContext minimumScore(float minimumScore)
           
 Map<String,BlockJoinQuery> nestedQueries()
           
 long nowInMillis()
           
 int numberOfShards()
           
 org.apache.lucene.search.Filter parsedFilter()
           
 SearchContext parsedFilter(org.apache.lucene.search.Filter filter)
           
 ParsedQuery parsedQuery()
           
 SearchContext parsedQuery(ParsedQuery query)
           
 PartialFieldsContext partialFields()
           
 void preProcess()
          Should be called before executing the main query and after all other parameters have been set.
 org.apache.lucene.search.Query query()
          The query to execute, might be rewritten.
 float queryBoost()
           
 SearchContext queryBoost(float queryBoost)
           
 IndexQueryParserService queryParserService()
           
 QuerySearchResult queryResult()
           
 boolean queryRewritten()
          Has the query been rewritten already?
 boolean release()
           
static void removeCurrent()
           
 InternalSearchRequest request()
           
 ScanContext scanContext()
           
 List<ScopePhase> scopePhases()
           
 ScriptFieldsContext scriptFields()
           
 ScriptService scriptService()
           
 Scroll scroll()
           
 SearchContext scroll(Scroll scroll)
           
 ContextIndexSearcher searcher()
           
 SearchType searchType()
           
 SearchContext searchType(SearchType searchType)
           
static void setCurrent(SearchContext value)
           
 SearchShardTarget shardTarget()
           
 SimilarityService similarityService()
           
 int size()
           
 SearchContext size(int size)
           
 MapperService.SmartNameFieldMappers smartFieldMappers(String name)
           
 FieldMapper smartNameFieldMapper(String name)
           
 FieldMappers smartNameFieldMappers(String name)
           
 MapperService.SmartNameObjectMapper smartNameObjectMapper(String name)
           
 org.apache.lucene.search.Sort sort()
           
 SearchContext sort(org.apache.lucene.search.Sort sort)
           
 long timeoutInMillis()
           
 void timeoutInMillis(long timeoutInMillis)
           
 boolean trackScores()
           
 SearchContext trackScores(boolean trackScores)
           
 String[] types()
           
 SearchContext updateRewriteQuery(org.apache.lucene.search.Query rewriteQuery)
          Rewrites the query and updates it.
 boolean version()
           
 void version(boolean version)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchContext

public SearchContext(long id,
                     InternalSearchRequest request,
                     SearchShardTarget shardTarget,
                     Engine.Searcher engineSearcher,
                     IndexService indexService,
                     IndexShard indexShard,
                     ScriptService scriptService)
Method Detail

setCurrent

public static void setCurrent(SearchContext value)

removeCurrent

public static void removeCurrent()

current

public static SearchContext current()

release

public boolean release()
                throws ElasticSearchException
Specified by:
release in interface Releasable
Throws:
ElasticSearchException

preProcess

public void preProcess()
Should be called before executing the main query and after all other parameters have been set.


id

public long id()

request

public InternalSearchRequest request()

searchType

public SearchType searchType()

searchType

public SearchContext searchType(SearchType searchType)

shardTarget

public SearchShardTarget shardTarget()

numberOfShards

public int numberOfShards()

hasTypes

public boolean hasTypes()

types

public String[] types()

queryBoost

public float queryBoost()

queryBoost

public SearchContext queryBoost(float queryBoost)

nowInMillis

public long nowInMillis()

scroll

public Scroll scroll()

scroll

public SearchContext scroll(Scroll scroll)

facets

public SearchContextFacets facets()

facets

public SearchContext facets(SearchContextFacets facets)

highlight

public SearchContextHighlight highlight()

highlight

public void highlight(SearchContextHighlight highlight)

hasScriptFields

public boolean hasScriptFields()

scriptFields

public ScriptFieldsContext scriptFields()

hasPartialFields

public boolean hasPartialFields()

partialFields

public PartialFieldsContext partialFields()

searcher

public ContextIndexSearcher searcher()

indexShard

public IndexShard indexShard()

mapperService

public MapperService mapperService()

analysisService

public AnalysisService analysisService()

queryParserService

public IndexQueryParserService queryParserService()

similarityService

public SimilarityService similarityService()

scriptService

public ScriptService scriptService()

filterCache

public FilterCache filterCache()

fieldDataCache

public FieldDataCache fieldDataCache()

idCache

public IdCache idCache()

timeoutInMillis

public long timeoutInMillis()

timeoutInMillis

public void timeoutInMillis(long timeoutInMillis)

minimumScore

public SearchContext minimumScore(float minimumScore)

minimumScore

public Float minimumScore()

sort

public SearchContext sort(org.apache.lucene.search.Sort sort)

sort

public org.apache.lucene.search.Sort sort()

trackScores

public SearchContext trackScores(boolean trackScores)

trackScores

public boolean trackScores()

parsedFilter

public SearchContext parsedFilter(org.apache.lucene.search.Filter filter)

parsedFilter

public org.apache.lucene.search.Filter parsedFilter()

aliasFilter

public org.apache.lucene.search.Filter aliasFilter()

parsedQuery

public SearchContext parsedQuery(ParsedQuery query)

parsedQuery

public ParsedQuery parsedQuery()

query

public org.apache.lucene.search.Query query()
The query to execute, might be rewritten.


queryRewritten

public boolean queryRewritten()
Has the query been rewritten already?


updateRewriteQuery

public SearchContext updateRewriteQuery(org.apache.lucene.search.Query rewriteQuery)
Rewrites the query and updates it. Only happens once.


from

public int from()

from

public SearchContext from(int from)

size

public int size()

size

public SearchContext size(int size)

hasFieldNames

public boolean hasFieldNames()

fieldNames

public List<String> fieldNames()

emptyFieldNames

public void emptyFieldNames()

explain

public boolean explain()

explain

public void explain(boolean explain)

groupStats

@Nullable
public List<String> groupStats()

groupStats

public void groupStats(List<String> groupStats)

version

public boolean version()

version

public void version(boolean version)

docIdsToLoad

public int[] docIdsToLoad()

docIdsToLoadFrom

public int docIdsToLoadFrom()

docIdsToLoadSize

public int docIdsToLoadSize()

docIdsToLoad

public SearchContext docIdsToLoad(int[] docIdsToLoad,
                                  int docsIdsToLoadFrom,
                                  int docsIdsToLoadSize)

accessed

public void accessed(long accessTime)

lastAccessTime

public long lastAccessTime()

keepAlive

public long keepAlive()

keepAlive

public void keepAlive(long keepAlive)

lookup

public SearchLookup lookup()

dfsResult

public DfsSearchResult dfsResult()

queryResult

public QuerySearchResult queryResult()

fetchResult

public FetchSearchResult fetchResult()

scopePhases

public List<ScopePhase> scopePhases()

addScopePhase

public void addScopePhase(ScopePhase scopePhase)

nestedQueries

public Map<String,BlockJoinQuery> nestedQueries()

addNestedQuery

public void addNestedQuery(String scope,
                           BlockJoinQuery query)

scanContext

public ScanContext scanContext()

smartFieldMappers

public MapperService.SmartNameFieldMappers smartFieldMappers(String name)

smartNameFieldMappers

public FieldMappers smartNameFieldMappers(String name)

smartNameFieldMapper

public FieldMapper smartNameFieldMapper(String name)

smartNameObjectMapper

public MapperService.SmartNameObjectMapper smartNameObjectMapper(String name)


Copyright © 2009-2012. All Rights Reserved.