org.apache.solr.search
Class SolrIndexSearcher

java.lang.Object
  extended by org.apache.lucene.search.Searcher
      extended by org.apache.solr.search.SolrIndexSearcher
All Implemented Interfaces:
java.rmi.Remote, org.apache.lucene.search.Searchable, SolrInfoMBean

public class SolrIndexSearcher
extends org.apache.lucene.search.Searcher
implements SolrInfoMBean

SolrIndexSearcher adds schema awareness and caching functionality over the lucene IndexSearcher.

Since:
solr 0.9
Version:
$Id: SolrIndexSearcher.java 541944 2007-05-26 22:29:12Z hossman $
Author:
yonik

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoMBean
SolrInfoMBean.Category
 
Field Summary
static boolean enableLazyFieldLoading
           
static int GET_SCORES
           
 
Constructor Summary
SolrIndexSearcher(IndexSchema schema, java.lang.String name, org.apache.lucene.store.Directory directory, boolean enableCache)
          Creates a searcher searching the index in the provided directory.
SolrIndexSearcher(IndexSchema schema, java.lang.String name, org.apache.lucene.index.IndexReader r, boolean enableCache)
          Creates a searcher searching the provided index.
SolrIndexSearcher(IndexSchema schema, java.lang.String name, java.lang.String path, boolean enableCache)
          Creates a searcher searching the index in the named directory.
 
Method Summary
 void cacheDocSet(org.apache.lucene.search.Query query, DocSet optionalAnswer, boolean mustCache)
          Compute and cache the DocSet that matches a query.
 java.lang.Object cacheInsert(java.lang.String cacheName, java.lang.Object key, java.lang.Object val)
          insert an entry in a generic cache
 java.lang.Object cacheLookup(java.lang.String cacheName, java.lang.Object key)
          lookup an entry in a generic cache
 void close()
          Free's resources associated with this searcher.
 DocSet convertFilter(org.apache.lucene.search.Filter lfilter)
          Converts a filter into a DocSet.
 org.apache.lucene.document.Document doc(int i)
          Retrieve the Document instance corresponding to the document id.
 org.apache.lucene.document.Document doc(int n, org.apache.lucene.document.FieldSelector fieldSelector)
          Retrieve a Document using a FieldSelector This method does not currently use the Solr document cache.
 org.apache.lucene.document.Document doc(int i, java.util.Set<java.lang.String> fields)
          Retrieve the Document instance corresponding to the document id.
 int docFreq(org.apache.lucene.index.Term term)
           
 org.apache.lucene.search.Explanation explain(org.apache.lucene.search.Weight weight, int i)
           
 SolrCache getCache(java.lang.String cacheName)
          return the named generic cache
 SolrInfoMBean.Category getCategory()
          Purpose of this Class
 java.lang.String getDescription()
          Simple one or two line description
 DocList getDocList(org.apache.lucene.search.Query query, DocSet filter, org.apache.lucene.search.Sort lsort, int offset, int len)
          Returns documents matching both query and filter and sorted by sort.
 DocList getDocList(org.apache.lucene.search.Query query, java.util.List<org.apache.lucene.search.Query> filterList, org.apache.lucene.search.Sort lsort, int offset, int len, int flags)
          Returns documents matching both query and the intersection of the filterList, sorted by sort.
 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 both query and filter and sorted by sort.
 DocListAndSet getDocListAndSet(org.apache.lucene.search.Query query, DocSet filter, org.apache.lucene.search.Sort lsort, int offset, int len)
          Returns documents matching both query and filter and sorted by sort.
 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 both query and filter and sorted by sort.
 DocListAndSet getDocListAndSet(org.apache.lucene.search.Query query, java.util.List<org.apache.lucene.search.Query> filterList, org.apache.lucene.search.Sort lsort, int offset, int len)
          Returns documents matching both query and the intersection of filterList, sorted by sort.
 DocListAndSet getDocListAndSet(org.apache.lucene.search.Query query, java.util.List<org.apache.lucene.search.Query> filterList, org.apache.lucene.search.Sort lsort, int offset, int len, int flags)
          Returns documents matching both query and the intersection of filterList, sorted by sort.
 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 both query and filter and sorted by sort.
 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 both query and filter and sorted by sort.
 java.net.URL[] getDocs()
          Documentation URL list.
protected  DocSet getDocSet(java.util.List<org.apache.lucene.search.Query> 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.
protected  DocSet getDocSetNC(org.apache.lucene.search.Query query, DocSet filter)
           
 int getFirstMatch(org.apache.lucene.index.Term t)
          Returns the first document number containing the term t Returns -1 if no document was found.
 java.lang.String getName()
          Simple common usage name, e.g.
 org.apache.lucene.index.IndexReader getReader()
          Direct access to the IndexReader used by this searcher
 IndexSchema getSchema()
          Direct access to the IndexSchema for use with this searcher
 org.apache.lucene.search.Similarity getSimilarity()
           
 java.lang.String getSource()
          CVS Source, SVN Source, etc
 java.lang.String getSourceId()
          CVS Id, SVN Id, etc
 NamedList getStatistics()
          Any statistics this instance would like to be publicly available via the Solr Administration interface.
 java.lang.String getVersion()
          Simple common usage version, e.g.
 int maxDoc()
           
 int numDocs(org.apache.lucene.search.Query a, DocSet b)
          Returns the number of documents that match both a and b.
 int numDocs(org.apache.lucene.search.Query a, org.apache.lucene.search.Query b)
          Returns the number of documents that match both a and b.
 org.apache.lucene.document.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.
 void readDocs(org.apache.lucene.document.Document[] docs, DocList ids)
          Takes a list of docs (the doc ids actually), and reads them into an array of Documents.
 void readDocs(org.apache.lucene.document.Document[] docs, DocList ids, java.util.Set<java.lang.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.
 void register()
          Register sub-objects such as caches
 org.apache.lucene.search.Query rewrite(org.apache.lucene.search.Query original)
           
 org.apache.lucene.search.Hits search(org.apache.lucene.search.Query query, org.apache.lucene.search.Filter filter)
           
 org.apache.lucene.search.Hits search(org.apache.lucene.search.Query query, org.apache.lucene.search.Filter filter, org.apache.lucene.search.Sort sort)
           
 void search(org.apache.lucene.search.Query query, org.apache.lucene.search.HitCollector results)
           
 org.apache.lucene.search.Hits search(org.apache.lucene.search.Query query, org.apache.lucene.search.Sort sort)
           
 void search(org.apache.lucene.search.Weight weight, org.apache.lucene.search.Filter filter, org.apache.lucene.search.HitCollector hitCollector)
           
 org.apache.lucene.search.TopDocs search(org.apache.lucene.search.Weight weight, org.apache.lucene.search.Filter filter, int i)
           
 org.apache.lucene.search.TopFieldDocs search(org.apache.lucene.search.Weight weight, org.apache.lucene.search.Filter filter, int i, org.apache.lucene.search.Sort sort)
           
 void setSimilarity(org.apache.lucene.search.Similarity similarity)
           
protected  DocList sortDocSet(DocSet set, org.apache.lucene.search.Sort sort, int nDocs)
           
 java.lang.String toString()
           
 void warm(SolrIndexSearcher old)
          Warm this searcher based on an old one (primarily for auto-cache warming).
 
Methods inherited from class org.apache.lucene.search.Searcher
createWeight, docFreqs, explain, search, search, search, search, search
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

enableLazyFieldLoading

public static final boolean enableLazyFieldLoading

GET_SCORES

public static final int GET_SCORES
See Also:
Constant Field Values
Constructor Detail

SolrIndexSearcher

public SolrIndexSearcher(IndexSchema schema,
                         java.lang.String name,
                         java.lang.String path,
                         boolean enableCache)
                  throws java.io.IOException
Creates a searcher searching the index in the named directory.

Throws:
java.io.IOException

SolrIndexSearcher

public SolrIndexSearcher(IndexSchema schema,
                         java.lang.String name,
                         org.apache.lucene.store.Directory directory,
                         boolean enableCache)
                  throws java.io.IOException
Creates a searcher searching the index in the provided directory.

Throws:
java.io.IOException

SolrIndexSearcher

public SolrIndexSearcher(IndexSchema schema,
                         java.lang.String name,
                         org.apache.lucene.index.IndexReader r,
                         boolean enableCache)
Creates a searcher searching the provided index.

Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

register

public void register()
Register sub-objects such as caches


close

public void close()
           throws java.io.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 interface org.apache.lucene.search.Searchable
Specified by:
close in class org.apache.lucene.search.Searcher
Throws:
java.io.IOException

getReader

public org.apache.lucene.index.IndexReader getReader()
Direct access to the IndexReader used by this searcher


getSchema

public IndexSchema getSchema()
Direct access to the IndexSchema for use with this searcher


search

public org.apache.lucene.search.Hits search(org.apache.lucene.search.Query query,
                                            org.apache.lucene.search.Filter filter,
                                            org.apache.lucene.search.Sort sort)
                                     throws java.io.IOException
Overrides:
search in class org.apache.lucene.search.Searcher
Throws:
java.io.IOException

search

public org.apache.lucene.search.Hits search(org.apache.lucene.search.Query query,
                                            org.apache.lucene.search.Filter filter)
                                     throws java.io.IOException
Overrides:
search in class org.apache.lucene.search.Searcher
Throws:
java.io.IOException

search

public org.apache.lucene.search.Hits search(org.apache.lucene.search.Query query,
                                            org.apache.lucene.search.Sort sort)
                                     throws java.io.IOException
Overrides:
search in class org.apache.lucene.search.Searcher
Throws:
java.io.IOException

search

public void search(org.apache.lucene.search.Query query,
                   org.apache.lucene.search.HitCollector results)
            throws java.io.IOException
Overrides:
search in class org.apache.lucene.search.Searcher
Throws:
java.io.IOException

setSimilarity

public void setSimilarity(org.apache.lucene.search.Similarity similarity)
Overrides:
setSimilarity in class org.apache.lucene.search.Searcher

getSimilarity

public org.apache.lucene.search.Similarity getSimilarity()
Overrides:
getSimilarity in class org.apache.lucene.search.Searcher

docFreq

public int docFreq(org.apache.lucene.index.Term term)
            throws java.io.IOException
Specified by:
docFreq in interface org.apache.lucene.search.Searchable
Specified by:
docFreq in class org.apache.lucene.search.Searcher
Throws:
java.io.IOException

doc

public org.apache.lucene.document.Document doc(int i)
                                        throws java.io.IOException
Retrieve the Document instance corresponding to the document id.

Specified by:
doc in interface org.apache.lucene.search.Searchable
Specified by:
doc in class org.apache.lucene.search.Searcher
Throws:
java.io.IOException

doc

public org.apache.lucene.document.Document doc(int n,
                                               org.apache.lucene.document.FieldSelector fieldSelector)
                                        throws java.io.IOException
Retrieve a Document using a FieldSelector This method does not currently use the Solr document cache.

Specified by:
doc in interface org.apache.lucene.search.Searchable
Throws:
java.io.IOException
See Also:
IndexReader.document(int, FieldSelector)

doc

public org.apache.lucene.document.Document doc(int i,
                                               java.util.Set<java.lang.String> fields)
                                        throws java.io.IOException
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).

Throws:
java.io.IOException

readDocs

public void readDocs(org.apache.lucene.document.Document[] docs,
                     DocList ids)
              throws java.io.IOException
Takes a list of docs (the doc ids actually), and reads them into an array of Documents.

Throws:
java.io.IOException

readDocs

public void readDocs(org.apache.lucene.document.Document[] docs,
                     DocList ids,
                     java.util.Set<java.lang.String> fields)
              throws java.io.IOException
Takes a list of docs (the doc ids actually) and a set of fields to load, and reads them into an array of Documents.

Throws:
java.io.IOException

maxDoc

public int maxDoc()
           throws java.io.IOException
Specified by:
maxDoc in interface org.apache.lucene.search.Searchable
Specified by:
maxDoc in class org.apache.lucene.search.Searcher
Throws:
java.io.IOException

search

public org.apache.lucene.search.TopDocs search(org.apache.lucene.search.Weight weight,
                                               org.apache.lucene.search.Filter filter,
                                               int i)
                                        throws java.io.IOException
Specified by:
search in interface org.apache.lucene.search.Searchable
Specified by:
search in class org.apache.lucene.search.Searcher
Throws:
java.io.IOException

search

public void search(org.apache.lucene.search.Weight weight,
                   org.apache.lucene.search.Filter filter,
                   org.apache.lucene.search.HitCollector hitCollector)
            throws java.io.IOException
Specified by:
search in interface org.apache.lucene.search.Searchable
Specified by:
search in class org.apache.lucene.search.Searcher
Throws:
java.io.IOException

rewrite

public org.apache.lucene.search.Query rewrite(org.apache.lucene.search.Query original)
                                       throws java.io.IOException
Specified by:
rewrite in interface org.apache.lucene.search.Searchable
Specified by:
rewrite in class org.apache.lucene.search.Searcher
Throws:
java.io.IOException

explain

public org.apache.lucene.search.Explanation explain(org.apache.lucene.search.Weight weight,
                                                    int i)
                                             throws java.io.IOException
Specified by:
explain in interface org.apache.lucene.search.Searchable
Specified by:
explain in class org.apache.lucene.search.Searcher
Throws:
java.io.IOException

search

public org.apache.lucene.search.TopFieldDocs search(org.apache.lucene.search.Weight weight,
                                                    org.apache.lucene.search.Filter filter,
                                                    int i,
                                                    org.apache.lucene.search.Sort sort)
                                             throws java.io.IOException
Specified by:
search in interface org.apache.lucene.search.Searchable
Specified by:
search in class org.apache.lucene.search.Searcher
Throws:
java.io.IOException

getFirstMatch

public int getFirstMatch(org.apache.lucene.index.Term t)
                  throws java.io.IOException
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 -
Returns:
the first document number containing the term
Throws:
java.io.IOException

cacheDocSet

public void cacheDocSet(org.apache.lucene.search.Query query,
                        DocSet optionalAnswer,
                        boolean mustCache)
                 throws java.io.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 key
optionalAnswer - 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:
java.io.IOException

getDocSet

public DocSet getDocSet(org.apache.lucene.search.Query query)
                 throws java.io.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:
java.io.IOException

getDocSet

protected DocSet getDocSet(java.util.List<org.apache.lucene.search.Query> queries)
                    throws java.io.IOException
Throws:
java.io.IOException

getDocSetNC

protected DocSet getDocSetNC(org.apache.lucene.search.Query query,
                             DocSet filter)
                      throws java.io.IOException
Throws:
java.io.IOException

getDocSet

public DocSet getDocSet(org.apache.lucene.search.Query query,
                        DocSet filter)
                 throws java.io.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:
query -
filter - may be null
Returns:
DocSet meeting the specified criteria, should not be modified by the caller.
Throws:
java.io.IOException

convertFilter

public DocSet convertFilter(org.apache.lucene.search.Filter lfilter)
                     throws java.io.IOException
Converts a filter into a DocSet. This method is not cache-aware and no caches are checked.

Throws:
java.io.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 java.io.IOException
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 -
filter - may be null
lsort - criteria by which to sort (if null, query relevance is used)
offset - offset into the list of documents to return
len - maximum number of documents to return
Returns:
DocList meeting the specified criteria, should not be modified by the caller.
Throws:
java.io.IOException

getDocList

public DocList getDocList(org.apache.lucene.search.Query query,
                          java.util.List<org.apache.lucene.search.Query> filterList,
                          org.apache.lucene.search.Sort lsort,
                          int offset,
                          int len,
                          int flags)
                   throws java.io.IOException
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 -
filterList - may be null
lsort - criteria by which to sort (if null, query relevance is used)
offset - offset into the list of documents to return
len - maximum number of documents to return
Returns:
DocList meeting the specified criteria, should not be modified by the caller.
Throws:
java.io.IOException

getDocList

public DocList getDocList(org.apache.lucene.search.Query query,
                          DocSet filter,
                          org.apache.lucene.search.Sort lsort,
                          int offset,
                          int len)
                   throws java.io.IOException
Returns documents matching both query and filter and sorted by sort. FUTURE: The returned DocList may be retrieved from a cache.

Parameters:
query -
filter - may be null
lsort - criteria by which to sort (if null, query relevance is used)
offset - offset into the list of documents to return
len - maximum number of documents to return
Returns:
DocList meeting the specified criteria, should not be modified by the caller.
Throws:
java.io.IOException

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 java.io.IOException
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 -
filter - may be null
lsort - criteria by which to sort (if null, query relevance is used)
offset - offset into the list of documents to return
len - maximum number of documents to return
Returns:
DocListAndSet meeting the specified criteria, should not be modified by the caller.
Throws:
java.io.IOException

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 java.io.IOException
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 -
filter - may be null
lsort - criteria by which to sort (if null, query relevance is used)
offset - offset into the list of documents to return
len - maximum number of documents to return
flags - user supplied flags for the result set
Returns:
DocListAndSet meeting the specified criteria, should not be modified by the caller.
Throws:
java.io.IOException

getDocListAndSet

public DocListAndSet getDocListAndSet(org.apache.lucene.search.Query query,
                                      java.util.List<org.apache.lucene.search.Query> filterList,
                                      org.apache.lucene.search.Sort lsort,
                                      int offset,
                                      int len)
                               throws java.io.IOException
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 -
filterList - may be null
lsort - criteria by which to sort (if null, query relevance is used)
offset - offset into the list of documents to return
len - maximum number of documents to return
Returns:
DocListAndSet meeting the specified criteria, should not be modified by the caller.
Throws:
java.io.IOException

getDocListAndSet

public DocListAndSet getDocListAndSet(org.apache.lucene.search.Query query,
                                      java.util.List<org.apache.lucene.search.Query> filterList,
                                      org.apache.lucene.search.Sort lsort,
                                      int offset,
                                      int len,
                                      int flags)
                               throws java.io.IOException
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 -
filterList - may be null
lsort - criteria by which to sort (if null, query relevance is used)
offset - offset into the list of documents to return
len - maximum number of documents to return
flags - user supplied flags for the result set
Returns:
DocListAndSet meeting the specified criteria, should not be modified by the caller.
Throws:
java.io.IOException

getDocListAndSet

public DocListAndSet getDocListAndSet(org.apache.lucene.search.Query query,
                                      DocSet filter,
                                      org.apache.lucene.search.Sort lsort,
                                      int offset,
                                      int len)
                               throws java.io.IOException
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 -
filter - may be null
lsort - criteria by which to sort (if null, query relevance is used)
offset - offset into the list of documents to return
len - maximum number of documents to return
Returns:
DocListAndSet meeting the specified criteria, should not be modified by the caller.
Throws:
java.io.IOException

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 java.io.IOException
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 -
filter - may be null
lsort - criteria by which to sort (if null, query relevance is used)
offset - offset into the list of documents to return
len - maximum number of documents to return
flags - user supplied flags for the result set
Returns:
DocListAndSet meeting the specified criteria, should not be modified by the caller.
Throws:
java.io.IOException

sortDocSet

protected DocList sortDocSet(DocSet set,
                             org.apache.lucene.search.Sort sort,
                             int nDocs)
                      throws java.io.IOException
Throws:
java.io.IOException

numDocs

public int numDocs(org.apache.lucene.search.Query a,
                   DocSet b)
            throws java.io.IOException
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 -
b -
Returns:
the numer of documents in the intersection between a and b.
Throws:
java.io.IOException

numDocs

public int numDocs(org.apache.lucene.search.Query a,
                   org.apache.lucene.search.Query b)
            throws java.io.IOException
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 -
b -
Returns:
the numer of documents in the intersection between a and b.
Throws:
java.io.IOException

readDocs

public org.apache.lucene.document.Document[] readDocs(DocList ids)
                                               throws java.io.IOException
Takes a list of docs (the doc ids actually), and returns an array of Documents containing all of the stored fields.

Throws:
java.io.IOException

warm

public void warm(SolrIndexSearcher old)
          throws java.io.IOException
Warm this searcher based on an old one (primarily for auto-cache warming).

Throws:
java.io.IOException

getCache

public SolrCache getCache(java.lang.String cacheName)
return the named generic cache


cacheLookup

public java.lang.Object cacheLookup(java.lang.String cacheName,
                                    java.lang.Object key)
lookup an entry in a generic cache


cacheInsert

public java.lang.Object cacheInsert(java.lang.String cacheName,
                                    java.lang.Object key,
                                    java.lang.Object val)
insert an entry in a generic cache


getName

public java.lang.String getName()
Description copied from interface: SolrInfoMBean
Simple common usage name, e.g. BasicQueryHandler, or fully qualified clas name.

Specified by:
getName in interface SolrInfoMBean

getVersion

public java.lang.String getVersion()
Description copied from interface: SolrInfoMBean
Simple common usage version, e.g. 2.0

Specified by:
getVersion in interface SolrInfoMBean

getDescription

public java.lang.String getDescription()
Description copied from interface: SolrInfoMBean
Simple one or two line description

Specified by:
getDescription in interface SolrInfoMBean

getCategory

public SolrInfoMBean.Category getCategory()
Description copied from interface: SolrInfoMBean
Purpose of this Class

Specified by:
getCategory in interface SolrInfoMBean

getSourceId

public java.lang.String getSourceId()
Description copied from interface: SolrInfoMBean
CVS Id, SVN Id, etc

Specified by:
getSourceId in interface SolrInfoMBean

getSource

public java.lang.String getSource()
Description copied from interface: SolrInfoMBean
CVS Source, SVN Source, etc

Specified by:
getSource in interface SolrInfoMBean

getDocs

public java.net.URL[] getDocs()
Description copied from interface: SolrInfoMBean
Documentation URL list.

Suggested documentation URLs: Homepage for sponsoring project, FAQ on class usage, Design doc for class, Wiki, bug reporting URL, etc...

Specified by:
getDocs in interface SolrInfoMBean

getStatistics

public NamedList getStatistics()
Description copied from interface: SolrInfoMBean
Any statistics this instance would like to be publicly available via the Solr Administration interface.

Any Object type may be stored in the list, but only the toString() representation will be used.

Specified by:
getStatistics in interface SolrInfoMBean


Copyright © 2006 - 2009 The Apache Software Foundation