Java Doc for SolrIndexSearcher.java in  » Search-Engine » apache-solr-1.2.0 » org » apache » solr » search » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Search Engine » apache solr 1.2.0 » org.apache.solr.search 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


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

Field Summary
final public static  intGET_SCORES
    
final public static  booleanenableLazyFieldLoading
    

Constructor Summary
public  SolrIndexSearcher(IndexSchema schema, String name, String path, boolean enableCache)
     Creates a searcher searching the index in the named directory.
public  SolrIndexSearcher(IndexSchema schema, String name, Directory directory, boolean enableCache)
     Creates a searcher searching the index in the provided directory.
public  SolrIndexSearcher(IndexSchema schema, String name, IndexReader r, boolean enableCache)
     Creates a searcher searching the provided index.

Method Summary
public  voidcacheDocSet(Query query, DocSet optionalAnswer, boolean mustCache)
     Compute and cache the DocSet that matches a query.
public  ObjectcacheInsert(String cacheName, Object key, Object val)
    
public  ObjectcacheLookup(String cacheName, Object key)
    
public  voidclose()
     Free's resources associated with this searcher.
public  DocSetconvertFilter(Filter lfilter)
     Converts a filter into a DocSet.
public  Documentdoc(int i)
     Retrieve the Document instance corresponding to the document id.
public  Documentdoc(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  Documentdoc(int i, Set<String> fields)
     Retrieve the Document instance corresponding to the document id.
public  intdocFreq(Term term)
    
public  Explanationexplain(Weight weight, int i)
    
public  SolrCachegetCache(String cacheName)
    
public  CategorygetCategory()
    
public  StringgetDescription()
    
public  DocListgetDocList(Query query, Query filter, Sort lsort, int offset, int len)
     Returns documents matching both query and filter and sorted by sort.
public  DocListgetDocList(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  DocListgetDocList(Query query, DocSet filter, Sort lsort, int offset, int len)
     Returns documents matching both query and filter and sorted by sort.
public  DocListAndSetgetDocListAndSet(Query query, Query filter, Sort lsort, int offset, int len)
     Returns documents matching both query and filter and sorted by sort.
public  DocListAndSetgetDocListAndSet(Query query, Query filter, Sort lsort, int offset, int len, int flags)
     Returns documents matching both query and filter and sorted by sort.
public  DocListAndSetgetDocListAndSet(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  DocListAndSetgetDocListAndSet(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  DocListAndSetgetDocListAndSet(Query query, DocSet filter, Sort lsort, int offset, int len)
     Returns documents matching both query and filter and sorted by sort.
public  DocListAndSetgetDocListAndSet(Query query, DocSet filter, Sort lsort, int offset, int len, int flags)
     Returns documents matching both query and filter and sorted by sort.
public  DocSetgetDocSet(Query query)
     Returns the set of document ids matching a query.
protected  DocSetgetDocSet(List<Query> queries)
    
public  DocSetgetDocSet(Query query, DocSet filter)
     Returns the set of document ids matching both the query and the filter.
protected  DocSetgetDocSetNC(Query query, DocSet filter)
    
public  URL[]getDocs()
    
public  intgetFirstMatch(Term t)
     Returns the first document number containing the term t Returns -1 if no document was found.
public  StringgetName()
    
 DocSetgetPositiveDocSet(Query q)
    
public  IndexReadergetReader()
    
public  IndexSchemagetSchema()
    
public  SimilaritygetSimilarity()
    
public  StringgetSource()
    
public  StringgetSourceId()
    
public  NamedListgetStatistics()
    
public  StringgetVersion()
    
public  intmaxDoc()
    
public  intnumDocs(Query a, DocSet b)
     Returns the number of documents that match both a and b.
public  intnumDocs(Query a, Query b)
     Returns the number of documents that match both a and b.
public  voidreadDocs(Document[] docs, DocList ids)
     Takes a list of docs (the doc ids actually), and reads them into an array of Documents.
public  voidreadDocs(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  voidregister()
    
public  Queryrewrite(Query original)
    
public  Hitssearch(Query query, Filter filter, Sort sort)
    
public  Hitssearch(Query query, Filter filter)
    
public  Hitssearch(Query query, Sort sort)
    
public  voidsearch(Query query, HitCollector results)
    
public  TopDocssearch(Weight weight, Filter filter, int i)
    
public  voidsearch(Weight weight, Filter filter, HitCollector hitCollector)
    
public  TopFieldDocssearch(Weight weight, Filter filter, int i, Sort sort)
    
public  voidsetSimilarity(Similarity similarity)
    
protected  DocListsortDocSet(DocSet set, Sort sort, int nDocs)
    
public  StringtoString()
    
public  voidwarm(SolrIndexSearcher old)
     Warm this searcher based on an old one (primarily for auto-cache warming).

Field Detail
GET_SCORES
final public static int GET_SCORES(Code)



enableLazyFieldLoading
final public static boolean enableLazyFieldLoading(Code)




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



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.




Method Detail
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.




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



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



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).



docFreq
public int docFreq(Term term) throws IOException(Code)



explain
public Explanation explain(Weight weight, int i) throws IOException(Code)



getCache
public SolrCache getCache(String cacheName)(Code)
return the named generic cache



getCategory
public Category getCategory()(Code)



getDescription
public String getDescription()(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
protected DocSet getDocSet(List<Query> queries) throws IOException(Code)



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.




getDocSetNC
protected DocSet getDocSetNC(Query query, DocSet filter) throws IOException(Code)



getDocs
public URL[] getDocs()(Code)



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



getName
public String getName()(Code)



getPositiveDocSet
DocSet getPositiveDocSet(Query q) throws IOException(Code)



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)



getSource
public String getSource()(Code)



getSourceId
public String getSourceId()(Code)



getStatistics
public NamedList getStatistics()(Code)



getVersion
public String getVersion()(Code)



maxDoc
public int maxDoc() throws IOException(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



rewrite
public Query rewrite(Query original) throws IOException(Code)



search
public Hits search(Query query, Filter filter, Sort sort) throws IOException(Code)



search
public Hits search(Query query, Filter filter) throws IOException(Code)



search
public Hits search(Query query, Sort sort) throws IOException(Code)



search
public void search(Query query, HitCollector results) 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)



sortDocSet
protected DocList sortDocSet(DocSet set, Sort sort, int nDocs) throws IOException(Code)



toString
public String toString()(Code)



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



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.