|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.avalon.framework.logger.AbstractLoggable | +--org.apache.cocoon.components.search.SimpleLuceneCocoonSearcherImpl
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.
Field Summary | |
protected static java.lang.String |
ANALYZER_CLASSNAME_CONFIG
Configuration element name of lucene's Analyzer class. |
protected static java.lang.String |
ANALYZER_CLASSNAME_DEFAULT
Configuration element default value of lucene's Analyzer class. |
protected static java.lang.String |
DEFAULT_QUERY_CONFIG
Configuration element name of default-query. |
protected static java.lang.String |
DEFAULT_QUERY_DEFAULT
Configuration element default value of default-query. |
protected static java.lang.String |
DEFAULT_SEARCH_FIELD_CONFIG
Configuration element name of default search field. |
protected static java.lang.String |
DEFAULT_SEARCH_FIELD_DEFAULT
Configuration element default value of lucene's default search field. |
protected static java.lang.String |
DIRECTORY_CONFIG
Configuration element name of lucene's default filesystem default directory. |
protected static java.lang.String |
DIRECTORY_DEFAULT
Configuration element default value of filesystem default directory. |
protected org.apache.avalon.framework.component.ComponentManager |
manager
The component manager instance |
protected static java.lang.String |
QUERYPARSER_CLASSNAME_CONFIG
Configuration element name of query parser class name. |
protected static java.lang.String |
QUERYPARSER_CLASSNAME_DEFAULT
Configuration element default value of queryparser-classname. |
Fields inherited from interface org.apache.cocoon.components.search.LuceneCocoonSearcher |
ROLE |
Constructor Summary | |
SimpleLuceneCocoonSearcherImpl()
|
Method Summary | |
void |
compose(org.apache.avalon.framework.component.ComponentManager manager)
Set the current ComponentManager instance used by this
Composable . |
void |
configure(org.apache.avalon.framework.configuration.Configuration conf)
configure |
void |
dispose()
Description of the Method |
org.apache.lucene.index.IndexReader |
getReader()
Get an IndexReader. |
void |
recycle()
Description of the Method |
org.apache.lucene.search.Hits |
search(java.lang.String query_string,
java.lang.String default_field)
Description of the Method |
void |
setAnalyzer(org.apache.lucene.analysis.Analyzer analyzer)
set an analyzer, overriding the analyzerClassnameDefault. |
void |
setDirectory(org.apache.lucene.store.Directory directory)
Sets the directory attribute of the SimpleLuceneCocoonSearcherImpl object |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLoggable |
getLogger, setLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final java.lang.String ANALYZER_CLASSNAME_CONFIG
Its value is
analyzer-classname
.
protected static final java.lang.String ANALYZER_CLASSNAME_DEFAULT
Its value is,
org.apache.lucene.analysis.standard.StandardAnalyzer
.
protected static final java.lang.String DEFAULT_SEARCH_FIELD_CONFIG
Its value is
default-seach-field
.
protected static final java.lang.String DEFAULT_SEARCH_FIELD_DEFAULT
Its value is body
.
protected static final java.lang.String DEFAULT_QUERY_CONFIG
Its value is
default-query
.
protected static final java.lang.String DEFAULT_QUERY_DEFAULT
Its value is null
.
protected static final java.lang.String QUERYPARSER_CLASSNAME_CONFIG
Its value is
queryparser-classname
.
protected static final java.lang.String QUERYPARSER_CLASSNAME_DEFAULT
Its value is
org.apache.lucene.queryParser.QueryParser
.
protected static final java.lang.String DIRECTORY_CONFIG
Its value is directory
.
protected static final java.lang.String DIRECTORY_DEFAULT
Its value is null
.
protected org.apache.avalon.framework.component.ComponentManager manager
Constructor Detail |
public SimpleLuceneCocoonSearcherImpl()
Method Detail |
public void setAnalyzer(org.apache.lucene.analysis.Analyzer analyzer)
setAnalyzer
in interface LuceneCocoonSearcher
analyzer
- The new analyzer valuepublic void setDirectory(org.apache.lucene.store.Directory directory)
setDirectory
in interface LuceneCocoonSearcher
directory
- The new directory valuepublic org.apache.lucene.index.IndexReader getReader() throws java.io.IOException
As an IndexReader might be cached, it is check if the indexReader is still valid.
java.io.IOException
- Description of Exceptionpublic void configure(org.apache.avalon.framework.configuration.Configuration conf) throws org.apache.avalon.framework.configuration.ConfigurationException
configure
in interface org.apache.avalon.framework.configuration.Configurable
conf
- Description of Parameterorg.apache.avalon.framework.configuration.ConfigurationException
- Description of Exceptionpublic void compose(org.apache.avalon.framework.component.ComponentManager manager) throws org.apache.avalon.framework.component.ComponentException
ComponentManager
instance used by this
Composable
.compose
in interface org.apache.avalon.framework.component.Composable
manager
- Description of Parameterorg.apache.avalon.framework.component.ComponentException
- Description of Exceptionpublic void dispose()
dispose
in interface org.apache.avalon.framework.activity.Disposable
public void recycle()
recycle
in interface org.apache.avalon.excalibur.pool.Recyclable
public org.apache.lucene.search.Hits search(java.lang.String query_string, java.lang.String default_field) throws ProcessingException
search
in interface LuceneCocoonSearcher
query_string
- Description of Parameterdefault_field
- Description of ParameterProcessingException
- Description of Exception
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |