|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.lucene.search.Searcher
org.apache.solr.search.SolrIndexSearcher
public class SolrIndexSearcher
SolrIndexSearcher adds schema awareness and caching functionality over the lucene IndexSearcher.
| 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 |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final boolean enableLazyFieldLoading
public static final int GET_SCORES
| Constructor Detail |
|---|
public SolrIndexSearcher(IndexSchema schema,
java.lang.String name,
java.lang.String path,
boolean enableCache)
throws java.io.IOException
java.io.IOException
public SolrIndexSearcher(IndexSchema schema,
java.lang.String name,
org.apache.lucene.store.Directory directory,
boolean enableCache)
throws java.io.IOException
java.io.IOException
public SolrIndexSearcher(IndexSchema schema,
java.lang.String name,
org.apache.lucene.index.IndexReader r,
boolean enableCache)
| Method Detail |
|---|
public java.lang.String toString()
toString in class java.lang.Objectpublic void register()
public void close()
throws java.io.IOException
close in interface org.apache.lucene.search.Searchableclose in class org.apache.lucene.search.Searcherjava.io.IOExceptionpublic org.apache.lucene.index.IndexReader getReader()
public IndexSchema getSchema()
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
search in class org.apache.lucene.search.Searcherjava.io.IOException
public org.apache.lucene.search.Hits search(org.apache.lucene.search.Query query,
org.apache.lucene.search.Filter filter)
throws java.io.IOException
search in class org.apache.lucene.search.Searcherjava.io.IOException
public org.apache.lucene.search.Hits search(org.apache.lucene.search.Query query,
org.apache.lucene.search.Sort sort)
throws java.io.IOException
search in class org.apache.lucene.search.Searcherjava.io.IOException
public void search(org.apache.lucene.search.Query query,
org.apache.lucene.search.HitCollector results)
throws java.io.IOException
search in class org.apache.lucene.search.Searcherjava.io.IOExceptionpublic void setSimilarity(org.apache.lucene.search.Similarity similarity)
setSimilarity in class org.apache.lucene.search.Searcherpublic org.apache.lucene.search.Similarity getSimilarity()
getSimilarity in class org.apache.lucene.search.Searcher
public int docFreq(org.apache.lucene.index.Term term)
throws java.io.IOException
docFreq in interface org.apache.lucene.search.SearchabledocFreq in class org.apache.lucene.search.Searcherjava.io.IOException
public org.apache.lucene.document.Document doc(int i)
throws java.io.IOException
Document instance corresponding to the document id.
doc in interface org.apache.lucene.search.Searchabledoc in class org.apache.lucene.search.Searcherjava.io.IOException
public org.apache.lucene.document.Document doc(int n,
org.apache.lucene.document.FieldSelector fieldSelector)
throws java.io.IOException
Document using a FieldSelector
This method does not currently use the Solr document cache.
doc in interface org.apache.lucene.search.Searchablejava.io.IOExceptionIndexReader.document(int, FieldSelector)
public org.apache.lucene.document.Document doc(int i,
java.util.Set<java.lang.String> fields)
throws java.io.IOException
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).
java.io.IOException
public void readDocs(org.apache.lucene.document.Document[] docs,
DocList ids)
throws java.io.IOException
java.io.IOException
public void readDocs(org.apache.lucene.document.Document[] docs,
DocList ids,
java.util.Set<java.lang.String> fields)
throws java.io.IOException
java.io.IOException
public int maxDoc()
throws java.io.IOException
maxDoc in interface org.apache.lucene.search.SearchablemaxDoc in class org.apache.lucene.search.Searcherjava.io.IOException
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
search in interface org.apache.lucene.search.Searchablesearch in class org.apache.lucene.search.Searcherjava.io.IOException
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
search in interface org.apache.lucene.search.Searchablesearch in class org.apache.lucene.search.Searcherjava.io.IOException
public org.apache.lucene.search.Query rewrite(org.apache.lucene.search.Query original)
throws java.io.IOException
rewrite in interface org.apache.lucene.search.Searchablerewrite in class org.apache.lucene.search.Searcherjava.io.IOException
public org.apache.lucene.search.Explanation explain(org.apache.lucene.search.Weight weight,
int i)
throws java.io.IOException
explain in interface org.apache.lucene.search.Searchableexplain in class org.apache.lucene.search.Searcherjava.io.IOException
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
search in interface org.apache.lucene.search.Searchablesearch in class org.apache.lucene.search.Searcherjava.io.IOException
public int getFirstMatch(org.apache.lucene.index.Term t)
throws java.io.IOException
t
Returns -1 if no document was found.
This method is primarily intended for clients that want to fetch
documents using a unique identifier."
t -
java.io.IOException
public void cacheDocSet(org.apache.lucene.search.Query query,
DocSet optionalAnswer,
boolean mustCache)
throws java.io.IOException
If the optionalAnswer DocSet is provided, it should *not* be modified after this call.
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.
java.io.IOException
public DocSet getDocSet(org.apache.lucene.search.Query query)
throws java.io.IOException
The DocSet returned should not be modified.
java.io.IOException
protected DocSet getDocSet(java.util.List<org.apache.lucene.search.Query> queries)
throws java.io.IOException
java.io.IOException
protected DocSet getDocSetNC(org.apache.lucene.search.Query query,
DocSet filter)
throws java.io.IOException
java.io.IOException
public DocSet getDocSet(org.apache.lucene.search.Query query,
DocSet filter)
throws java.io.IOException
query - filter - may be null
java.io.IOException
public DocSet convertFilter(org.apache.lucene.search.Filter lfilter)
throws java.io.IOException
java.io.IOException
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
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.
query - 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
java.io.IOException
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
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.
query - 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
java.io.IOException
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
query and filter
and sorted by sort.
FUTURE: The returned DocList may be retrieved from a cache.
query - 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
java.io.IOException
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
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.
query - 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
java.io.IOException
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
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.
query - 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
java.io.IOException
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
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.
query - 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
java.io.IOException
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
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.
query - 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
java.io.IOException
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
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.
query - 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
java.io.IOException
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
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.
query - 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
java.io.IOException
protected DocList sortDocSet(DocSet set,
org.apache.lucene.search.Sort sort,
int nDocs)
throws java.io.IOException
java.io.IOException
public int numDocs(org.apache.lucene.search.Query a,
DocSet b)
throws java.io.IOException
a and b.
This method is cache-aware and may check as well as modify the cache.
a - b -
a and b.
java.io.IOException
public int numDocs(org.apache.lucene.search.Query a,
org.apache.lucene.search.Query b)
throws java.io.IOException
a and b.
This method is cache-aware and may check as well as modify the cache.
a - b -
a and b.
java.io.IOException
public org.apache.lucene.document.Document[] readDocs(DocList ids)
throws java.io.IOException
java.io.IOException
public void warm(SolrIndexSearcher old)
throws java.io.IOException
java.io.IOExceptionpublic SolrCache getCache(java.lang.String cacheName)
public java.lang.Object cacheLookup(java.lang.String cacheName,
java.lang.Object key)
public java.lang.Object cacheInsert(java.lang.String cacheName,
java.lang.Object key,
java.lang.Object val)
public java.lang.String getName()
SolrInfoMBean
getName in interface SolrInfoMBeanpublic java.lang.String getVersion()
SolrInfoMBean
getVersion in interface SolrInfoMBeanpublic java.lang.String getDescription()
SolrInfoMBean
getDescription in interface SolrInfoMBeanpublic SolrInfoMBean.Category getCategory()
SolrInfoMBean
getCategory in interface SolrInfoMBeanpublic java.lang.String getSourceId()
SolrInfoMBean
getSourceId in interface SolrInfoMBeanpublic java.lang.String getSource()
SolrInfoMBean
getSource in interface SolrInfoMBeanpublic java.net.URL[] getDocs()
SolrInfoMBeanSuggested documentation URLs: Homepage for sponsoring project, FAQ on class usage, Design doc for class, Wiki, bug reporting URL, etc...
getDocs in interface SolrInfoMBeanpublic NamedList getStatistics()
SolrInfoMBean
Any Object type may be stored in the list, but only the
toString() representation will be used.
getStatistics in interface SolrInfoMBean
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||