| org.apache.solr.search.SolrIndexSearcher
SolrIndexSearcher | public class SolrIndexSearcher extends Searcher implements SolrInfoMBean(Code) | | SolrIndexSearcher adds schema awareness and caching functionality
over the lucene IndexSearcher.
author: yonik version: $Id: SolrIndexSearcher.java 541944 2007-05-26 22:29:12Z hossman $ since: solr 0.9 |
Inner Class :class SetNonLazyFieldSelector implements FieldSelector | |
Method Summary | |
public void | cacheDocSet(Query query, DocSet optionalAnswer, boolean mustCache) Compute and cache the DocSet that matches a query. | public Object | cacheInsert(String cacheName, Object key, Object val) | public Object | cacheLookup(String cacheName, Object key) | public void | close() Free's resources associated with this searcher. | public DocSet | convertFilter(Filter lfilter) Converts a filter into a DocSet. | public Document | doc(int i) Retrieve the
Document instance corresponding to the document id. | public Document | doc(int n, FieldSelector fieldSelector) Retrieve a
Document using a
org.apache.lucene.document.FieldSelector This method does not currently use the Solr document cache. | public Document | doc(int i, Set<String> fields) Retrieve the
Document instance corresponding to the document id. | public int | docFreq(Term term) | public Explanation | explain(Weight weight, int i) | public SolrCache | getCache(String cacheName) | public Category | getCategory() | public String | getDescription() | public DocList | getDocList(Query query, Query filter, Sort lsort, int offset, int len) Returns documents matching both query and filter
and sorted by sort . | public DocList | getDocList(Query query, List<Query> filterList, Sort lsort, int offset, int len, int flags) Returns documents matching both query and the
intersection of the filterList , sorted by sort . | public DocList | getDocList(Query query, DocSet filter, Sort lsort, int offset, int len) Returns documents matching both query and filter
and sorted by sort . | public DocListAndSet | getDocListAndSet(Query query, Query filter, Sort lsort, int offset, int len) Returns documents matching both query and filter
and sorted by sort . | public DocListAndSet | getDocListAndSet(Query query, Query filter, Sort lsort, int offset, int len, int flags) Returns documents matching both query and filter
and sorted by sort . | public DocListAndSet | getDocListAndSet(Query query, List<Query> filterList, Sort lsort, int offset, int len) Returns documents matching both query and the intersection
of filterList , sorted by sort . | public DocListAndSet | getDocListAndSet(Query query, List<Query> filterList, Sort lsort, int offset, int len, int flags) Returns documents matching both query and the intersection
of filterList , sorted by sort . | public DocListAndSet | getDocListAndSet(Query query, DocSet filter, Sort lsort, int offset, int len) Returns documents matching both query and filter
and sorted by sort . | public DocListAndSet | getDocListAndSet(Query query, DocSet filter, Sort lsort, int offset, int len, int flags) Returns documents matching both query and filter
and sorted by sort . | public DocSet | getDocSet(Query query) Returns the set of document ids matching a query. | protected DocSet | getDocSet(List<Query> queries) | public DocSet | getDocSet(Query query, DocSet filter) Returns the set of document ids matching both the query and the filter. | protected DocSet | getDocSetNC(Query query, DocSet filter) | public URL[] | getDocs() | public int | getFirstMatch(Term t) Returns the first document number containing the term t
Returns -1 if no document was found. | public String | getName() | DocSet | getPositiveDocSet(Query q) | public IndexReader | getReader() | public IndexSchema | getSchema() | public Similarity | getSimilarity() | public String | getSource() | public String | getSourceId() | public NamedList | getStatistics() | public String | getVersion() | public int | maxDoc() | public int | numDocs(Query a, DocSet b) Returns the number of documents that match both a and b . | public int | numDocs(Query a, Query b) Returns the number of documents that match both a and b . | public void | readDocs(Document[] docs, DocList ids) Takes a list of docs (the doc ids actually), and reads them into an array
of Documents. | public void | readDocs(Document[] docs, DocList ids, Set<String> fields) Takes a list of docs (the doc ids actually) and a set of fields to load,
and reads them into an array of Documents. | public Document[] | readDocs(DocList ids) Takes a list of docs (the doc ids actually), and returns an array
of Documents containing all of the stored fields. | public void | register() | public Query | rewrite(Query original) | public Hits | search(Query query, Filter filter, Sort sort) | public Hits | search(Query query, Filter filter) | public Hits | search(Query query, Sort sort) | public void | search(Query query, HitCollector results) | public TopDocs | search(Weight weight, Filter filter, int i) | public void | search(Weight weight, Filter filter, HitCollector hitCollector) | public TopFieldDocs | search(Weight weight, Filter filter, int i, Sort sort) | public void | setSimilarity(Similarity similarity) | protected DocList | sortDocSet(DocSet set, Sort sort, int nDocs) | public String | toString() | public void | warm(SolrIndexSearcher old) Warm this searcher based on an old one (primarily for auto-cache warming). |
GET_SCORES | final public static int GET_SCORES(Code) | | |
enableLazyFieldLoading | final public static boolean enableLazyFieldLoading(Code) | | |
SolrIndexSearcher | public SolrIndexSearcher(IndexSchema schema, String name, Directory directory, boolean enableCache) throws IOException(Code) | | Creates a searcher searching the index in the provided directory.
|
SolrIndexSearcher | public SolrIndexSearcher(IndexSchema schema, String name, IndexReader r, boolean enableCache)(Code) | | Creates a searcher searching the provided index.
|
cacheDocSet | public void cacheDocSet(Query query, DocSet optionalAnswer, boolean mustCache) throws IOException(Code) | | 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 key Parameters: optionalAnswer - the DocSet to be cached - if null, it will be computed. Parameters: 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. |
close | public void close() throws IOException(Code) | | Free's resources associated with this searcher.
In particular, the underlying reader and any cache's in use are closed.
|
convertFilter | public DocSet convertFilter(Filter lfilter) throws IOException(Code) | | Converts a filter into a DocSet.
This method is not cache-aware and no caches are checked.
|
doc | public Document doc(int i) throws IOException(Code) | | Retrieve the
Document instance corresponding to the document id.
|
doc | public Document doc(int n, FieldSelector fieldSelector) throws IOException(Code) | | Retrieve a
Document using a
org.apache.lucene.document.FieldSelector This method does not currently use the Solr document cache.
See Also: IndexReader.document(intFieldSelector) See Also: |
doc | public Document doc(int i, Set<String> fields) throws IOException(Code) | | Retrieve the
Document instance corresponding to the document id.
Note: The document will have all fields accessable, but if a field
filter is provided, only the provided fields will be loaded (the
remainder will be available lazily).
|
getCategory | public Category getCategory()(Code) | | |
getDocList | public DocList getDocList(Query query, Query filter, Sort lsort, int offset, int len) throws IOException(Code) | | Returns documents matching both query and filter
and sorted by sort .
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: query - Parameters: filter - may be null Parameters: lsort - criteria by which to sort (if null, query relevance is used) Parameters: offset - offset into the list of documents to return Parameters: len - maximum number of documents to return DocList meeting the specified criteria, should not be modified by the caller. throws: IOException - |
getDocList | public DocList getDocList(Query query, List<Query> filterList, Sort lsort, int offset, int len, int flags) throws IOException(Code) | | Returns documents matching both query and the
intersection of the filterList , sorted by sort .
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: query - Parameters: filterList - may be null Parameters: lsort - criteria by which to sort (if null, query relevance is used) Parameters: offset - offset into the list of documents to return Parameters: len - maximum number of documents to return DocList meeting the specified criteria, should not be modified by the caller. throws: IOException - |
getDocList | public DocList getDocList(Query query, DocSet filter, Sort lsort, int offset, int len) throws IOException(Code) | | Returns documents matching both query and filter
and sorted by sort .
FUTURE: The returned DocList may be retrieved from a cache.
Parameters: query - Parameters: filter - may be null Parameters: lsort - criteria by which to sort (if null, query relevance is used) Parameters: offset - offset into the list of documents to return Parameters: len - maximum number of documents to return DocList meeting the specified criteria, should not be modified by the caller. throws: IOException - |
getDocListAndSet | public DocListAndSet getDocListAndSet(Query query, Query filter, Sort lsort, int offset, int len) throws IOException(Code) | | Returns documents matching both query and filter
and sorted by sort . Also returns the compete set of documents
matching query and filter (regardless of offset and len ).
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: query - Parameters: filter - may be null Parameters: lsort - criteria by which to sort (if null, query relevance is used) Parameters: offset - offset into the list of documents to return Parameters: len - maximum number of documents to return DocListAndSet meeting the specified criteria, should not be modified by the caller. throws: IOException - |
getDocListAndSet | public DocListAndSet getDocListAndSet(Query query, Query filter, Sort lsort, int offset, int len, int flags) throws IOException(Code) | | Returns documents matching both query and filter
and sorted by sort . Also returns the compete set of documents
matching query and filter (regardless of offset and len ).
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: query - Parameters: filter - may be null Parameters: lsort - criteria by which to sort (if null, query relevance is used) Parameters: offset - offset into the list of documents to return Parameters: len - maximum number of documents to return Parameters: flags - user supplied flags for the result set DocListAndSet meeting the specified criteria, should not be modified by the caller. throws: IOException - |
getDocListAndSet | public DocListAndSet getDocListAndSet(Query query, List<Query> filterList, Sort lsort, int offset, int len) throws IOException(Code) | | Returns documents matching both query and the intersection
of filterList , sorted by sort .
Also returns the compete set of documents
matching query and filter
(regardless of offset and len ).
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: query - Parameters: filterList - may be null Parameters: lsort - criteria by which to sort (if null, query relevance is used) Parameters: offset - offset into the list of documents to return Parameters: len - maximum number of documents to return DocListAndSet meeting the specified criteria, should not be modified by the caller. throws: IOException - |
getDocListAndSet | public DocListAndSet getDocListAndSet(Query query, List<Query> filterList, Sort lsort, int offset, int len, int flags) throws IOException(Code) | | Returns documents matching both query and the intersection
of filterList , sorted by sort .
Also returns the compete set of documents
matching query and filter
(regardless of offset and len ).
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: query - Parameters: filterList - may be null Parameters: lsort - criteria by which to sort (if null, query relevance is used) Parameters: offset - offset into the list of documents to return Parameters: len - maximum number of documents to return Parameters: flags - user supplied flags for the result set DocListAndSet meeting the specified criteria, should not be modified by the caller. throws: IOException - |
getDocListAndSet | public DocListAndSet getDocListAndSet(Query query, DocSet filter, Sort lsort, int offset, int len) throws IOException(Code) | | Returns documents matching both query and filter
and sorted by sort . Also returns the compete set of documents
matching query and filter (regardless of offset and len ).
FUTURE: The returned DocList may be retrieved from a cache.
Parameters: query - Parameters: filter - may be null Parameters: lsort - criteria by which to sort (if null, query relevance is used) Parameters: offset - offset into the list of documents to return Parameters: len - maximum number of documents to return DocListAndSet meeting the specified criteria, should not be modified by the caller. throws: IOException - |
getDocListAndSet | public DocListAndSet getDocListAndSet(Query query, DocSet filter, Sort lsort, int offset, int len, int flags) throws IOException(Code) | | Returns documents matching both query and filter
and sorted by sort . Also returns the compete set of documents
matching query and filter (regardless of offset and len ).
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: query - Parameters: filter - may be null Parameters: lsort - criteria by which to sort (if null, query relevance is used) Parameters: offset - offset into the list of documents to return Parameters: len - maximum number of documents to return Parameters: flags - user supplied flags for the result set DocListAndSet meeting the specified criteria, should not be modified by the caller. throws: IOException - |
getDocSet | public DocSet getDocSet(Query query) throws IOException(Code) | | 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.
|
getDocSet | public DocSet getDocSet(Query query, DocSet filter) throws IOException(Code) | | 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: query - Parameters: filter - may be null DocSet meeting the specified criteria, should not be modified by the caller. |
getFirstMatch | public int getFirstMatch(Term t) throws IOException(Code) | | Returns the first document number containing the term t
Returns -1 if no document was found.
This method is primarily intended for clients that want to fetch
documents using a unique identifier."
Parameters: t - the first document number containing the term |
getReader | public IndexReader getReader()(Code) | | Direct access to the IndexReader used by this searcher
|
getSchema | public IndexSchema getSchema()(Code) | | Direct access to the IndexSchema for use with this searcher
|
getSimilarity | public Similarity getSimilarity()(Code) | | |
numDocs | public int numDocs(Query a, DocSet b) throws IOException(Code) | | Returns the number of documents that match both a and b .
This method is cache-aware and may check as well as modify the cache.
Parameters: a - Parameters: b - the numer of documents in the intersection between a and b . throws: IOException - |
numDocs | public int numDocs(Query a, Query b) throws IOException(Code) | | Returns the number of documents that match both a and b .
This method is cache-aware and may check as well as modify the cache.
Parameters: a - Parameters: b - the numer of documents in the intersection between a and b . throws: IOException - |
readDocs | public void readDocs(Document[] docs, DocList ids) throws IOException(Code) | | Takes a list of docs (the doc ids actually), and reads them into an array
of Documents.
|
readDocs | public void readDocs(Document[] docs, DocList ids, Set<String> fields) throws IOException(Code) | | Takes a list of docs (the doc ids actually) and a set of fields to load,
and reads them into an array of Documents.
|
readDocs | public Document[] readDocs(DocList ids) throws IOException(Code) | | Takes a list of docs (the doc ids actually), and returns an array
of Documents containing all of the stored fields.
|
register | public void register()(Code) | | Register sub-objects such as caches
|
search | public Hits search(Query query, Filter filter, Sort sort) throws IOException(Code) | | |
search | public TopDocs search(Weight weight, Filter filter, int i) throws IOException(Code) | | |
search | public void search(Weight weight, Filter filter, HitCollector hitCollector) throws IOException(Code) | | |
search | public TopFieldDocs search(Weight weight, Filter filter, int i, Sort sort) throws IOException(Code) | | |
setSimilarity | public void setSimilarity(Similarity similarity)(Code) | | |
|
|