| org.apache.cocoon.components.search.SimpleLuceneCocoonSearcherImpl
SimpleLuceneCocoonSearcherImpl | public class SimpleLuceneCocoonSearcherImpl extends AbstractLogEnabled implements LuceneCocoonSearcher,Configurable,Serviceable,Disposable,Recyclable(Code) | | This class provides searching via lucene.
In order to do searching you need a lucene Directory where the lucene generated
index resides.
Moreover you must know the lucene Analyzer which has been used for
indexing, and which will be used for searching.
Knowing this you can may start searching having a query which is parsable
by an QueryParser, and having the name of the default field to use in
searching.
This class returns an Hit object as its search result.
author: Bernhard Huber version: CVS $Id: SimpleLuceneCocoonSearcherImpl.java 433543 2006-08-22 06:22:54Z crossley $ |
Inner Class :static class IndexReaderCache | |
Method Summary | |
public void | configure(Configuration conf) | public void | dispose() Dispose this component, releasing IndexSearcher, and IndexReaderCache. | public Analyzer | getAnalyzer() get the analyzer. | public IndexReader | getReader() Get an IndexReader. | public void | recycle() Recycle this component, releasing IndexSearcher, and IndexReaderCache. | public Hits | search(String query_string, String default_field) Search lucene index. | public Hits | search(Query query) Search lucene index. | public void | service(ServiceManager manager) Set the current ServiceManager instance used by this
Serviceable . | public void | setAnalyzer(Analyzer analyzer) set an analyzer, overriding the analyzerClassnameDefault. | public void | setDirectory(Directory directory) |
ANALYZER_CLASSNAME_CONFIG | final protected static String ANALYZER_CLASSNAME_CONFIG(Code) | | Configuration element name of lucene's Analyzer class.
Its value is
analyzer-classname .
|
ANALYZER_CLASSNAME_DEFAULT | final protected static String ANALYZER_CLASSNAME_DEFAULT(Code) | | Configuration element default value of lucene's Analyzer class.
Its value is,
org.apache.lucene.analysis.standard.StandardAnalyzer .
|
DEFAULT_QUERY_CONFIG | final protected static String DEFAULT_QUERY_CONFIG(Code) | | Configuration element name of default-query.
Its value is
default-query .
|
DEFAULT_QUERY_DEFAULT | final protected static String DEFAULT_QUERY_DEFAULT(Code) | | Configuration element default value of default-query.
Its value is null .
|
DEFAULT_SEARCH_FIELD_CONFIG | final protected static String DEFAULT_SEARCH_FIELD_CONFIG(Code) | | Configuration element name of default search field.
Its value is
default-seach-field .
|
DEFAULT_SEARCH_FIELD_DEFAULT | final protected static String DEFAULT_SEARCH_FIELD_DEFAULT(Code) | | Configuration element default value of lucene's default search field.
Its value is body .
|
DIRECTORY_CONFIG | final protected static String DIRECTORY_CONFIG(Code) | | Configuration element name of lucene's default filesystem default
directory.
Its value is directory .
|
DIRECTORY_DEFAULT | final protected static String DIRECTORY_DEFAULT(Code) | | Configuration element default value of filesystem default directory.
Its value is null .
|
QUERYPARSER_CLASSNAME_CONFIG | final protected static String QUERYPARSER_CLASSNAME_CONFIG(Code) | | Configuration element name of query parser class name.
Its value is
queryparser-classname .
|
QUERYPARSER_CLASSNAME_DEFAULT | final protected static String QUERYPARSER_CLASSNAME_DEFAULT(Code) | | Configuration element default value of queryparser-classname.
Its value is
org.apache.lucene.queryParser.QueryParser .
|
manager | protected ServiceManager manager(Code) | | The service manager instance
|
configure | public void configure(Configuration conf) throws ConfigurationException(Code) | | configure this component
Parameters: conf - of this component exception: ConfigurationException - is thrown iff configuration of this component fails |
dispose | public void dispose()(Code) | | Dispose this component, releasing IndexSearcher, and IndexReaderCache.
|
getAnalyzer | public Analyzer getAnalyzer()(Code) | | get the analyzer.
|
getReader | public IndexReader getReader() throws IOException(Code) | | Get an IndexReader.
As an IndexReader might be cached, it is check if the indexReader is
still valid.
IndexReader an up to date indexReader exception: IOException - is thrown iff it's impossible to create an IndexReader |
recycle | public void recycle()(Code) | | Recycle this component, releasing IndexSearcher, and IndexReaderCache.
|
search | public Hits search(String query_string, String default_field) throws ProcessingException(Code) | | Search lucene index.
Parameters: query_string - is lucene's query string Parameters: default_field - the lucene field to run the query lucene Hits exception: ProcessingException - iff its not possible do run the query |
search | public Hits search(Query query) throws ProcessingException(Code) | | Search lucene index.
This method is designed to be used by other components, or Flowscripts
Parameters: query - the lucene Query lucene Hits exception: ProcessingException - if its not possible do run the query |
service | public void service(ServiceManager manager) throws ServiceException(Code) | | Set the current ServiceManager instance used by this
Serviceable .
Parameters: manager - manager of this component exception: ServiceException - is never thrown |
setAnalyzer | public void setAnalyzer(Analyzer analyzer)(Code) | | set an analyzer, overriding the analyzerClassnameDefault.
Parameters: analyzer - The new analyzer value |
setDirectory | public void setDirectory(Directory directory)(Code) | | Sets the directory attribute of the SimpleLuceneCocoonSearcherImpl object
Parameters: directory - The new directory value |
|
|