Class SolrIndexSearcher
- java.lang.Object
-
- org.apache.lucene.search.IndexSearcher
-
- org.apache.solr.search.SolrIndexSearcher
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,SolrInfoBean
,SolrMetricProducer
public class SolrIndexSearcher extends org.apache.lucene.search.IndexSearcher implements Closeable, SolrInfoBean, SolrMetricProducer
SolrIndexSearcher adds schema awareness and caching functionality overIndexSearcher
.- Since:
- solr 0.9
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SolrIndexSearcher.DocsEnumState
static class
SolrIndexSearcher.ProcessedFilter
INTERNAL: The response object fromgetProcessedFilter(DocSet, List)
.-
Nested classes/interfaces inherited from class org.apache.lucene.search.IndexSearcher
org.apache.lucene.search.IndexSearcher.LeafSlice
-
Nested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoBean
SolrInfoBean.Category, SolrInfoBean.Group
-
-
Field Summary
Fields Modifier and Type Field Description static int
GET_DOCLIST
static int
GET_DOCSET
static int
GET_SCORES
static int
NO_CHECK_QCACHE
static AtomicLong
numCloses
static AtomicLong
numOpens
static String
STATISTICS_KEY
static String
STATS_SOURCE
static int
TERMINATE_EARLY
-
Constructor Summary
Constructors Constructor Description SolrIndexSearcher(SolrCore core, String path, IndexSchema schema, String name, org.apache.lucene.index.DirectoryReader r, boolean closeReader, boolean enableCache, boolean reserveDirectory, DirectoryFactory directoryFactory)
SolrIndexSearcher(SolrCore core, String path, IndexSchema schema, SolrIndexConfig config, String name, boolean enableCache, DirectoryFactory directoryFactory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
cacheDocSet(org.apache.lucene.search.Query query, DocSet optionalAnswer, boolean mustCache)
Compute and cache the DocSet that matches a query.Object
cacheInsert(String cacheName, Object key, Object val)
insert an entry in a generic cacheObject
cacheLookup(String cacheName, Object key)
lookup an entry in a generic cachevoid
close()
Free's resources associated with this searcher.org.apache.lucene.search.CollectionStatistics
collectionStatistics(String field)
org.apache.lucene.document.Document
doc(int docId)
Retrieve theDocument
instance corresponding to the document id.org.apache.lucene.document.Document
doc(int i, Set<String> fields)
Retrieve theDocument
instance corresponding to the document id.void
doc(int docId, org.apache.lucene.index.StoredFieldVisitor visitor)
Visit a document's fields using aStoredFieldVisitor
.int
docFreq(org.apache.lucene.index.Term term)
org.apache.lucene.search.Explanation
explain(org.apache.lucene.search.Query query, int doc)
SolrCache
getCache(String cacheName)
return the named generic cacheSolrInfoBean.Category
getCategory()
Category of this componentSolrCore
getCore()
String
getDescription()
Simple one or two line descriptionSolrDocumentFetcher
getDocFetcher()
DocList
getDocList(org.apache.lucene.search.Query query, List<org.apache.lucene.search.Query> filterList, org.apache.lucene.search.Sort lsort, int offset, int len, int flags)
Returns documents matching bothquery
and the intersection of thefilterList
, sorted bysort
.DocList
getDocList(org.apache.lucene.search.Query query, org.apache.lucene.search.Query filter, org.apache.lucene.search.Sort lsort, int offset, int len)
Returns documents matching bothquery
andfilter
and sorted bysort
.DocList
getDocList(org.apache.lucene.search.Query query, DocSet filter, org.apache.lucene.search.Sort lsort, int offset, int len)
Returns documents matching bothquery
andfilter
and sorted bysort
.DocListAndSet
getDocListAndSet(org.apache.lucene.search.Query query, List<org.apache.lucene.search.Query> filterList, org.apache.lucene.search.Sort lsort, int offset, int len)
Returns documents matching bothquery
and the intersection offilterList
, sorted bysort
.DocListAndSet
getDocListAndSet(org.apache.lucene.search.Query query, List<org.apache.lucene.search.Query> filterList, org.apache.lucene.search.Sort lsort, int offset, int len, int flags)
Returns documents matching bothquery
and the intersection offilterList
, sorted bysort
.DocListAndSet
getDocListAndSet(org.apache.lucene.search.Query query, org.apache.lucene.search.Query filter, org.apache.lucene.search.Sort lsort, int offset, int len)
Returns documents matching bothquery
andfilter
and sorted bysort
.DocListAndSet
getDocListAndSet(org.apache.lucene.search.Query query, org.apache.lucene.search.Query filter, org.apache.lucene.search.Sort lsort, int offset, int len, int flags)
Returns documents matching bothquery
andfilter
and sorted bysort
.DocListAndSet
getDocListAndSet(org.apache.lucene.search.Query query, DocSet filter, org.apache.lucene.search.Sort lsort, int offset, int len)
Returns documents matching bothquery
andfilter
and sorted bysort
.DocListAndSet
getDocListAndSet(org.apache.lucene.search.Query query, DocSet filter, org.apache.lucene.search.Sort lsort, int offset, int len, int flags)
Returns documents matching bothquery
andfilter
and sorted bysort
.DocSet
getDocSet(List<org.apache.lucene.search.Query> queries)
Returns the set of document ids matching all queries.DocSet
getDocSet(org.apache.lucene.search.Query query)
Returns the set of document ids matching a query.DocSet
getDocSet(org.apache.lucene.search.Query query, DocSet filter)
Returns the set of document ids matching both the query and the filter.DocSet
getDocSet(SolrIndexSearcher.DocsEnumState deState)
BitDocSet
getDocSetBits(org.apache.lucene.search.Query q)
protected DocSet
getDocSetNC(org.apache.lucene.search.Query query, DocSet filter)
org.apache.lucene.index.FieldInfos
getFieldInfos()
Iterable<String>
getFieldNames()
Returns a collection of all field names the index reader knows about.SolrCache<String,UnInvertedField>
getFieldValueCache()
expert: internal API, subject to changeSolrCache<org.apache.lucene.search.Query,DocSet>
getFilterCache()
int
getFirstMatch(org.apache.lucene.index.Term t)
Returns the first document number containing the termt
Returns -1 if no document was found.IndexFingerprint
getIndexFingerprint(long maxVersion)
org.apache.lucene.index.DirectoryReader
getIndexReader()
BitDocSet
getLiveDocs()
Deprecated.org.apache.lucene.util.Bits
getLiveDocsBits()
Returns an efficient random-accessBits
of the live docs.BitDocSet
getLiveDocSet()
Returns an efficient random-accessDocSet
of the live docs.Set<String>
getMetricNames()
Modifiable set of metric names that this component reports (default is null, which means none).String
getName()
Simple common usage name, e.g.long
getOpenNanoTime()
Date
getOpenTimeStamp()
String
getPath()
SolrIndexSearcher.ProcessedFilter
getProcessedFilter(DocSet setFilter, List<org.apache.lucene.search.Query> queries)
INTERNAL: Processes conjunction (AND) of both args into aSolrIndexSearcher.ProcessedFilter
result.org.apache.lucene.index.DirectoryReader
getRawReader()
Raw reader (no fieldcaches etc).IndexSchema
getSchema()
Direct access to the IndexSchema for use with this searcherorg.apache.lucene.index.LeafReader
getSlowAtomicReader()
Not recommended to call this method unless there is some particular reason due to internally callingSlowCompositeReaderWrapper
.SolrMetricsContext
getSolrMetricsContext()
Implementing classes should override this method to provide the context obtained inSolrMetricProducer.initializeMetrics(SolrMetricsContext, String)
to ensure proper cleanup of metrics at the end of the life-cycle of this component.StatsCache
getStatsCache()
long
getWarmupTime()
void
initializeMetrics(SolrMetricsContext parentContext, String scope)
Initialize metrics specific to this producer.static void
initRegenerators(SolrConfig solrConfig)
boolean
intersects(DocSet a, SolrIndexSearcher.DocsEnumState deState)
boolean
isCachingEnabled()
boolean
isLiveDocsInstantiated()
org.apache.lucene.search.CollectionStatistics
localCollectionStatistics(String field)
org.apache.lucene.search.TermStatistics
localTermStatistics(org.apache.lucene.index.Term term, int docFreq, long totalTermFreq)
long
lookupId(org.apache.lucene.util.BytesRef idBytes)
lookup the docid by the unique key field, and return the id *within* the leaf reader in the low 32 bits, and the index of the leaf reader in the high 32 bits.int
maxDoc()
int
numDocs()
int
numDocs(org.apache.lucene.search.Query a, org.apache.lucene.search.Query b)
Returns the number of documents that match botha
andb
.int
numDocs(org.apache.lucene.search.Query a, DocSet b)
Returns the number of documents that match botha
andb
.int
numDocs(DocSet a, SolrIndexSearcher.DocsEnumState deState)
void
register()
Register sub-objects such as caches and our own metricsQueryResult
search(QueryResult qr, QueryCommand cmd)
void
setLiveDocs(DocSet docs)
protected void
sortDocSet(QueryResult qr, QueryCommand cmd)
org.apache.lucene.search.TermStatistics
termStatistics(org.apache.lucene.index.Term term, int docFreq, long totalTermFreq)
String
toString()
void
warm(SolrIndexSearcher old)
Warm this searcher based on an old one (primarily for auto-cache warming).org.apache.lucene.search.Sort
weightSort(org.apache.lucene.search.Sort sort)
Returns a weighted sort according to this searcherSortSpec
weightSortSpec(SortSpec originalSortSpec, org.apache.lucene.search.Sort nullEquivalent)
Returns a weighted sort spec according to this searcher-
Methods inherited from class org.apache.lucene.search.IndexSearcher
count, createWeight, explain, getDefaultQueryCache, getDefaultQueryCachingPolicy, getDefaultSimilarity, getExecutor, getQueryCache, getQueryCachingPolicy, getSimilarity, getSlices, getTopReaderContext, rewrite, search, search, search, search, search, search, searchAfter, searchAfter, searchAfter, setDefaultQueryCache, setDefaultQueryCachingPolicy, setQueryCache, setQueryCachingPolicy, setSimilarity, slices, termStatistics
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.solr.core.SolrInfoBean
getMetricRegistry, getMetricsSnapshot, registerMetricName
-
Methods inherited from interface org.apache.solr.metrics.SolrMetricProducer
initializeMetrics
-
-
-
-
Field Detail
-
STATS_SOURCE
public static final String STATS_SOURCE
- See Also:
- Constant Field Values
-
STATISTICS_KEY
public static final String STATISTICS_KEY
- See Also:
- Constant Field Values
-
numOpens
public static final AtomicLong numOpens
-
numCloses
public static final AtomicLong numCloses
-
NO_CHECK_QCACHE
public static final int NO_CHECK_QCACHE
- See Also:
- Constant Field Values
-
GET_DOCSET
public static final int GET_DOCSET
- See Also:
- Constant Field Values
-
TERMINATE_EARLY
public static final int TERMINATE_EARLY
- See Also:
- Constant Field Values
-
GET_DOCLIST
public static final int GET_DOCLIST
- See Also:
- Constant Field Values
-
GET_SCORES
public static final int GET_SCORES
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SolrIndexSearcher
public SolrIndexSearcher(SolrCore core, String path, IndexSchema schema, SolrIndexConfig config, String name, boolean enableCache, DirectoryFactory directoryFactory) throws IOException
- Throws:
IOException
-
SolrIndexSearcher
public SolrIndexSearcher(SolrCore core, String path, IndexSchema schema, String name, org.apache.lucene.index.DirectoryReader r, boolean closeReader, boolean enableCache, boolean reserveDirectory, DirectoryFactory directoryFactory) throws IOException
- Throws:
IOException
-
-
Method Detail
-
getDocFetcher
public SolrDocumentFetcher getDocFetcher()
-
getStatsCache
public StatsCache getStatsCache()
-
getFieldInfos
public org.apache.lucene.index.FieldInfos getFieldInfos()
-
termStatistics
public org.apache.lucene.search.TermStatistics termStatistics(org.apache.lucene.index.Term term, int docFreq, long totalTermFreq) throws IOException
- Overrides:
termStatistics
in classorg.apache.lucene.search.IndexSearcher
- Throws:
IOException
-
collectionStatistics
public org.apache.lucene.search.CollectionStatistics collectionStatistics(String field) throws IOException
- Overrides:
collectionStatistics
in classorg.apache.lucene.search.IndexSearcher
- Throws:
IOException
-
localTermStatistics
public org.apache.lucene.search.TermStatistics localTermStatistics(org.apache.lucene.index.Term term, int docFreq, long totalTermFreq) throws IOException
- Throws:
IOException
-
localCollectionStatistics
public org.apache.lucene.search.CollectionStatistics localCollectionStatistics(String field) throws IOException
- Throws:
IOException
-
isCachingEnabled
public boolean isCachingEnabled()
-
getPath
public String getPath()
-
toString
public String toString()
- Overrides:
toString
in classorg.apache.lucene.search.IndexSearcher
-
getCore
public SolrCore getCore()
-
maxDoc
public final int maxDoc()
-
numDocs
public final int numDocs()
-
docFreq
public final int docFreq(org.apache.lucene.index.Term term) throws IOException
- Throws:
IOException
-
getSlowAtomicReader
public final org.apache.lucene.index.LeafReader getSlowAtomicReader()
Not recommended to call this method unless there is some particular reason due to internally callingSlowCompositeReaderWrapper
. UseIndexSearcher.leafContexts
to get the sub readers instead of using this method.
-
getRawReader
public final org.apache.lucene.index.DirectoryReader getRawReader()
Raw reader (no fieldcaches etc). Useful for operations like addIndexes
-
getIndexReader
public final org.apache.lucene.index.DirectoryReader getIndexReader()
- Overrides:
getIndexReader
in classorg.apache.lucene.search.IndexSearcher
-
register
public void register()
Register sub-objects such as caches and our own metrics
-
close
public void close() throws IOException
Free's resources associated with this searcher. In particular, the underlying reader and any cache's in use are closed.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceSolrMetricProducer
- Throws:
IOException
-
getSchema
public IndexSchema getSchema()
Direct access to the IndexSchema for use with this searcher
-
getFieldNames
public Iterable<String> getFieldNames()
Returns a collection of all field names the index reader knows about.
-
initRegenerators
public static void initRegenerators(SolrConfig solrConfig)
-
search
public QueryResult search(QueryResult qr, QueryCommand cmd) throws IOException
- Throws:
IOException
-
doc
public org.apache.lucene.document.Document doc(int docId) throws IOException
Retrieve theDocument
instance corresponding to the document id.- Overrides:
doc
in classorg.apache.lucene.search.IndexSearcher
- Throws:
IOException
- See Also:
SolrDocumentFetcher
-
doc
public final void doc(int docId, org.apache.lucene.index.StoredFieldVisitor visitor) throws IOException
Visit a document's fields using aStoredFieldVisitor
. This method does not currently add to the Solr document cache.- Overrides:
doc
in classorg.apache.lucene.search.IndexSearcher
- Throws:
IOException
- See Also:
IndexReader.document(int, StoredFieldVisitor)
,SolrDocumentFetcher
-
doc
public final org.apache.lucene.document.Document doc(int i, Set<String> fields) throws IOException
Retrieve theDocument
instance corresponding to the document id.NOTE: the document will have all fields accessible, but if a field filter is provided, only the provided fields will be loaded (the remainder will be available lazily).
- Overrides:
doc
in classorg.apache.lucene.search.IndexSearcher
- Throws:
IOException
- See Also:
SolrDocumentFetcher
-
getFieldValueCache
public SolrCache<String,UnInvertedField> getFieldValueCache()
expert: internal API, subject to change
-
weightSort
public org.apache.lucene.search.Sort weightSort(org.apache.lucene.search.Sort sort) throws IOException
Returns a weighted sort according to this searcher- Throws:
IOException
-
weightSortSpec
public SortSpec weightSortSpec(SortSpec originalSortSpec, org.apache.lucene.search.Sort nullEquivalent) throws IOException
Returns a weighted sort spec according to this searcher- Throws:
IOException
-
getFirstMatch
public int getFirstMatch(org.apache.lucene.index.Term t) throws IOException
Returns the first document number containing the termt
Returns -1 if no document was found. This method is primarily intended for clients that want to fetch documents using a unique identifier."- Returns:
- the first document number containing the term
- Throws:
IOException
-
lookupId
public long lookupId(org.apache.lucene.util.BytesRef idBytes) throws IOException
lookup the docid by the unique key field, and return the id *within* the leaf reader in the low 32 bits, and the index of the leaf reader in the high 32 bits. -1 is returned if not found.- Throws:
IOException
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
cacheDocSet
public void cacheDocSet(org.apache.lucene.search.Query query, DocSet optionalAnswer, boolean mustCache) throws IOException
Compute and cache the DocSet that matches a query. The normal usage is expected to be cacheDocSet(myQuery, null,false) meaning that Solr will determine if the Query warrants caching, and if so, will compute the DocSet that matches the Query and cache it. If the answer to the query is already cached, nothing further will be done.If the optionalAnswer DocSet is provided, it should *not* be modified after this call.
- Parameters:
query
- the lucene query that will act as the keyoptionalAnswer
- the DocSet to be cached - if null, it will be computed.mustCache
- if true, a best effort will be made to cache this entry. if false, heuristics may be used to determine if it should be cached.- Throws:
IOException
-
getDocSetBits
public BitDocSet getDocSetBits(org.apache.lucene.search.Query q) throws IOException
- Throws:
IOException
-
getDocSet
public DocSet getDocSet(org.apache.lucene.search.Query query) throws IOException
Returns the set of document ids matching a query. This method is cache-aware and attempts to retrieve the answer from the cache if possible. If the answer was not cached, it may have been inserted into the cache as a result of this call. This method can handle negative queries.The DocSet returned should not be modified.
- Throws:
IOException
-
getLiveDocs
@Deprecated public BitDocSet getLiveDocs() throws IOException
Deprecated.- Throws:
IOException
-
getLiveDocSet
public BitDocSet getLiveDocSet() throws IOException
Returns an efficient random-accessDocSet
of the live docs. It's cached. Never null.- Throws:
IOException
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
- the type of DocSet returned may change in the future
-
getLiveDocsBits
public org.apache.lucene.util.Bits getLiveDocsBits() throws IOException
Returns an efficient random-accessBits
of the live docs. It's cached. Null means all docs are live. Use this likeLeafReader.getLiveDocs()
.- Throws:
IOException
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
isLiveDocsInstantiated
public boolean isLiveDocsInstantiated()
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
setLiveDocs
public void setLiveDocs(DocSet docs)
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
getDocSet
public DocSet getDocSet(List<org.apache.lucene.search.Query> queries) throws IOException
Returns the set of document ids matching all queries. This method is cache-aware and attempts to retrieve the answer from the cache if possible. If the answer was not cached, it may have been inserted into the cache as a result of this call. This method can handle negative queries. A null/empty list results ingetLiveDocSet()
.The DocSet returned should not be modified.
- Throws:
IOException
-
getProcessedFilter
public SolrIndexSearcher.ProcessedFilter getProcessedFilter(DocSet setFilter, List<org.apache.lucene.search.Query> queries) throws IOException
INTERNAL: Processes conjunction (AND) of both args into aSolrIndexSearcher.ProcessedFilter
result. Either arg may be null/empty thus doesn't restrict the matching docs. Queries typically are resolved against the filter cache, and populate it.- Throws:
IOException
-
getDocSet
public DocSet getDocSet(SolrIndexSearcher.DocsEnumState deState) throws IOException
- Throws:
IOException
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
getDocSetNC
protected DocSet getDocSetNC(org.apache.lucene.search.Query query, DocSet filter) throws IOException
- Throws:
IOException
-
getDocSet
public DocSet getDocSet(org.apache.lucene.search.Query query, DocSet filter) throws IOException
Returns the set of document ids matching both the query and the filter. This method is cache-aware and attempts to retrieve the answer from the cache if possible. If the answer was not cached, it may have been inserted into the cache as a result of this call.- Parameters:
filter
- may be null- Returns:
- DocSet meeting the specified criteria, should not be modified by the caller.
- Throws:
IOException
-
getDocList
public DocList getDocList(org.apache.lucene.search.Query query, org.apache.lucene.search.Query filter, org.apache.lucene.search.Sort lsort, int offset, int len) throws IOException
Returns documents matching bothquery
andfilter
and sorted bysort
.This method is cache aware and may retrieve
filter
from the cache or make an insertion into the cache as a result of this call.FUTURE: The returned DocList may be retrieved from a cache.
- Parameters:
filter
- may be nulllsort
- criteria by which to sort (if null, query relevance is used)offset
- offset into the list of documents to returnlen
- maximum number of documents to return- Returns:
- DocList meeting the specified criteria, should not be modified by the caller.
- Throws:
IOException
- If there is a low-level I/O error.
-
getDocList
public DocList getDocList(org.apache.lucene.search.Query query, List<org.apache.lucene.search.Query> filterList, org.apache.lucene.search.Sort lsort, int offset, int len, int flags) throws IOException
Returns documents matching bothquery
and the intersection of thefilterList
, sorted bysort
.This method is cache aware and may retrieve
filter
from the cache or make an insertion into the cache as a result of this call.FUTURE: The returned DocList may be retrieved from a cache.
- Parameters:
filterList
- may be nulllsort
- criteria by which to sort (if null, query relevance is used)offset
- offset into the list of documents to returnlen
- maximum number of documents to return- Returns:
- DocList meeting the specified criteria, should not be modified by the caller.
- Throws:
IOException
- If there is a low-level I/O error.
-
getDocList
public DocList getDocList(org.apache.lucene.search.Query query, DocSet filter, org.apache.lucene.search.Sort lsort, int offset, int len) throws IOException
Returns documents matching bothquery
andfilter
and sorted bysort
. FUTURE: The returned DocList may be retrieved from a cache.- Parameters:
filter
- may be nulllsort
- criteria by which to sort (if null, query relevance is used)offset
- offset into the list of documents to returnlen
- maximum number of documents to return- Returns:
- DocList meeting the specified criteria, should not be modified by the caller.
- Throws:
IOException
- If there is a low-level I/O error.
-
getDocListAndSet
public DocListAndSet getDocListAndSet(org.apache.lucene.search.Query query, org.apache.lucene.search.Query filter, org.apache.lucene.search.Sort lsort, int offset, int len) throws IOException
Returns documents matching bothquery
andfilter
and sorted bysort
. Also returns the complete set of documents matchingquery
andfilter
(regardless ofoffset
andlen
).This method is cache aware and may retrieve
filter
from the cache or make an insertion into the cache as a result of this call.FUTURE: The returned DocList may be retrieved from a cache.
The DocList and DocSet returned should not be modified.
- Parameters:
filter
- may be nulllsort
- criteria by which to sort (if null, query relevance is used)offset
- offset into the list of documents to returnlen
- maximum number of documents to return- Returns:
- DocListAndSet meeting the specified criteria, should not be modified by the caller.
- Throws:
IOException
- If there is a low-level I/O error.
-
getDocListAndSet
public DocListAndSet getDocListAndSet(org.apache.lucene.search.Query query, org.apache.lucene.search.Query filter, org.apache.lucene.search.Sort lsort, int offset, int len, int flags) throws IOException
Returns documents matching bothquery
andfilter
and sorted bysort
. Also returns the compete set of documents matchingquery
andfilter
(regardless ofoffset
andlen
).This method is cache aware and may retrieve
filter
from the cache or make an insertion into the cache as a result of this call.FUTURE: The returned DocList may be retrieved from a cache.
The DocList and DocSet returned should not be modified.
- Parameters:
filter
- may be nulllsort
- criteria by which to sort (if null, query relevance is used)offset
- offset into the list of documents to returnlen
- maximum number of documents to returnflags
- user supplied flags for the result set- Returns:
- DocListAndSet meeting the specified criteria, should not be modified by the caller.
- Throws:
IOException
- If there is a low-level I/O error.
-
getDocListAndSet
public DocListAndSet getDocListAndSet(org.apache.lucene.search.Query query, List<org.apache.lucene.search.Query> filterList, org.apache.lucene.search.Sort lsort, int offset, int len) throws IOException
Returns documents matching bothquery
and the intersection offilterList
, sorted bysort
. Also returns the compete set of documents matchingquery
andfilter
(regardless ofoffset
andlen
).This method is cache aware and may retrieve
filter
from the cache or make an insertion into the cache as a result of this call.FUTURE: The returned DocList may be retrieved from a cache.
The DocList and DocSet returned should not be modified.
- Parameters:
filterList
- may be nulllsort
- criteria by which to sort (if null, query relevance is used)offset
- offset into the list of documents to returnlen
- maximum number of documents to return- Returns:
- DocListAndSet meeting the specified criteria, should not be modified by the caller.
- Throws:
IOException
- If there is a low-level I/O error.
-
getDocListAndSet
public DocListAndSet getDocListAndSet(org.apache.lucene.search.Query query, List<org.apache.lucene.search.Query> filterList, org.apache.lucene.search.Sort lsort, int offset, int len, int flags) throws IOException
Returns documents matching bothquery
and the intersection offilterList
, sorted bysort
. Also returns the compete set of documents matchingquery
andfilter
(regardless ofoffset
andlen
).This method is cache aware and may retrieve
filter
from the cache or make an insertion into the cache as a result of this call.FUTURE: The returned DocList may be retrieved from a cache.
The DocList and DocSet returned should not be modified.
- Parameters:
filterList
- may be nulllsort
- criteria by which to sort (if null, query relevance is used)offset
- offset into the list of documents to returnlen
- maximum number of documents to returnflags
- user supplied flags for the result set- Returns:
- DocListAndSet meeting the specified criteria, should not be modified by the caller.
- Throws:
IOException
- If there is a low-level I/O error.
-
getDocListAndSet
public DocListAndSet getDocListAndSet(org.apache.lucene.search.Query query, DocSet filter, org.apache.lucene.search.Sort lsort, int offset, int len) throws IOException
Returns documents matching bothquery
andfilter
and sorted bysort
. Also returns the compete set of documents matchingquery
andfilter
(regardless ofoffset
andlen
).FUTURE: The returned DocList may be retrieved from a cache.
- Parameters:
filter
- may be nulllsort
- criteria by which to sort (if null, query relevance is used)offset
- offset into the list of documents to returnlen
- maximum number of documents to return- Returns:
- DocListAndSet meeting the specified criteria, should not be modified by the caller.
- Throws:
IOException
- If there is a low-level I/O error.
-
getDocListAndSet
public DocListAndSet getDocListAndSet(org.apache.lucene.search.Query query, DocSet filter, org.apache.lucene.search.Sort lsort, int offset, int len, int flags) throws IOException
Returns documents matching bothquery
andfilter
and sorted bysort
. Also returns the compete set of documents matchingquery
andfilter
(regardless ofoffset
andlen
).This method is cache aware and may make an insertion into the cache as a result of this call.
FUTURE: The returned DocList may be retrieved from a cache.
The DocList and DocSet returned should not be modified.
- Parameters:
filter
- may be nulllsort
- criteria by which to sort (if null, query relevance is used)offset
- offset into the list of documents to returnlen
- maximum number of documents to returnflags
- user supplied flags for the result set- Returns:
- DocListAndSet meeting the specified criteria, should not be modified by the caller.
- Throws:
IOException
- If there is a low-level I/O error.
-
sortDocSet
protected void sortDocSet(QueryResult qr, QueryCommand cmd) throws IOException
- Throws:
IOException
-
numDocs
public int numDocs(org.apache.lucene.search.Query a, DocSet b) throws IOException
Returns the number of documents that match botha
andb
.This method is cache-aware and may check as well as modify the cache.
- Returns:
- the number of documents in the intersection between
a
andb
. - Throws:
IOException
- If there is a low-level I/O error.
-
numDocs
public int numDocs(DocSet a, SolrIndexSearcher.DocsEnumState deState) throws IOException
- Throws:
IOException
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
numDocs
public int numDocs(org.apache.lucene.search.Query a, org.apache.lucene.search.Query b) throws IOException
Returns the number of documents that match botha
andb
.This method is cache-aware and may check as well as modify the cache.
- Returns:
- the number of documents in the intersection between
a
andb
. - Throws:
IOException
- If there is a low-level I/O error.
-
intersects
public boolean intersects(DocSet a, SolrIndexSearcher.DocsEnumState deState) throws IOException
- Throws:
IOException
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
warm
public void warm(SolrIndexSearcher old)
Warm this searcher based on an old one (primarily for auto-cache warming).
-
cacheLookup
public Object cacheLookup(String cacheName, Object key)
lookup an entry in a generic cache
-
cacheInsert
public Object cacheInsert(String cacheName, Object key, Object val)
insert an entry in a generic cache
-
getOpenTimeStamp
public Date getOpenTimeStamp()
-
getOpenNanoTime
public long getOpenNanoTime()
-
explain
public org.apache.lucene.search.Explanation explain(org.apache.lucene.search.Query query, int doc) throws IOException
- Overrides:
explain
in classorg.apache.lucene.search.IndexSearcher
- Throws:
IOException
-
getIndexFingerprint
public IndexFingerprint getIndexFingerprint(long maxVersion) throws IOException
- Throws:
IOException
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
- gets a cached version of the IndexFingerprint for this searcher
-
getName
public String getName()
Description copied from interface:SolrInfoBean
Simple common usage name, e.g. BasicQueryHandler, or fully qualified class name.- Specified by:
getName
in interfaceSolrInfoBean
-
getDescription
public String getDescription()
Description copied from interface:SolrInfoBean
Simple one or two line description- Specified by:
getDescription
in interfaceSolrInfoBean
-
getCategory
public SolrInfoBean.Category getCategory()
Description copied from interface:SolrInfoBean
Category of this component- Specified by:
getCategory
in interfaceSolrInfoBean
-
getMetricNames
public Set<String> getMetricNames()
Description copied from interface:SolrInfoBean
Modifiable set of metric names that this component reports (default is null, which means none). If not null then this set is used bySolrInfoBean.registerMetricName(String)
to capture what metrics names are reported from this component.NOTE: this set has to allow iteration under modifications.
- Specified by:
getMetricNames
in interfaceSolrInfoBean
-
getSolrMetricsContext
public SolrMetricsContext getSolrMetricsContext()
Description copied from interface:SolrMetricProducer
Implementing classes should override this method to provide the context obtained inSolrMetricProducer.initializeMetrics(SolrMetricsContext, String)
to ensure proper cleanup of metrics at the end of the life-cycle of this component.- Specified by:
getSolrMetricsContext
in interfaceSolrMetricProducer
-
initializeMetrics
public void initializeMetrics(SolrMetricsContext parentContext, String scope)
Description copied from interface:SolrMetricProducer
Initialize metrics specific to this producer.- Specified by:
initializeMetrics
in interfaceSolrMetricProducer
- Parameters:
parentContext
- parent metrics context. If this component has the same life-cycle as the parent it can simply use the parent context, otherwise it should obtain a child context usingSolrMetricsContext.getChildContext(Object)
passingthis
as the child.scope
- component scope
-
getWarmupTime
public long getWarmupTime()
-
-