|
Xindice API version 1.2m1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.xindice.core.indexer.LuceneIndexer
LuceneIndexer is used for maintaining full text indexes. It operates on documents instead of elements and allows to search for documents using native Lucene query. There can be only one LuceneIndexer per collection, however, it may have more than one IndexPattern.
Every IndexPattern corresponds to a Lucene document field. For every Xindice document, value of all matching elements will be indexed by a single Lucene document, allowing to search across the patterns.
Sample LuceneIndexer configuration:
<index name='fulltext' class='org.apache.xindice.core.indexer.LuceneIndexer' analyzer='org.apache.lucene.analysis.SimpleAnalyzer'> <pattern pattern='meta@title' alias='title'/> <pattern pattern='description' alias='text'/> </index>
To search over this sample index, one could issue a query "title:tutorial
AND text:xml"
.
For more details about LuceneIndexer configuration please see documentation for
setConfig(org.apache.xindice.util.Configuration)
Field Summary | |
static String |
DEFANALYZER
|
static String |
KEYNAME
|
Fields inherited from interface org.apache.xindice.core.indexer.Indexer |
STYLE_FULLTEXT, STYLE_NODENAME, STYLE_NODEVALUE |
Constructor Summary | |
LuceneIndexer()
|
Method Summary | |
boolean |
close()
close closes the DBObject |
boolean |
create()
Creates necessary resources. |
boolean |
drop()
drop instructs the DBObjectimplementation to remove itself from existence. |
boolean |
exists()
exists returns whether or not a physical representation of this DBObject actually exists. |
void |
flush()
flush forcefully flushes any unwritten buffers to disk. |
org.apache.lucene.analysis.Analyzer |
getAnalyzer()
|
Configuration |
getConfig()
getConfig retrieves the configuration information for the Configurable object instance. |
IndexerEventHandler |
getIndexerEventHandler()
Creates new instance of a handler to listen to indexer events. |
String |
getIndexStyle()
getIndexStyle returns the Index style. |
String |
getName()
getName retrieves the contextually important name of the object |
String |
getPatternAlias(IndexPattern pattern)
Return alias for the given pattern. |
IndexPattern[] |
getPatterns()
Returns this Indexer's patterns. |
boolean |
isOpened()
isOpened returns whether or not the DBObject is opened for business. |
boolean |
open()
open opens the DBObject |
IndexMatch[] |
queryMatches(IndexQuery query)
queryMatches retrieves a set of IndexMatch instances that match the supplied query. |
IndexMatch[] |
queryMatches(org.apache.lucene.search.Query query)
Same as Indexer.queryMatches(IndexQuery) , but accepts compiled Lucene query as
parameter. |
void |
setCollection(Collection collection)
setCollection tells the Indexer who its parent is. |
void |
setConfig(Configuration config)
Configures LuceneIndexer instance. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String KEYNAME
public static final String DEFANALYZER
Constructor Detail |
public LuceneIndexer()
Method Detail |
public String getIndexStyle()
Indexer
getIndexStyle
in interface Indexer
public IndexPattern[] getPatterns()
getPatterns
in interface Indexer
public String getPatternAlias(IndexPattern pattern)
pattern
- IndexPattern
public void setConfig(Configuration config) throws XindiceException
Indexer.getPatterns()
setConfig
in interface Configurable
config
- Configuration to apply
XindiceException
- Configuration does not have required information,
Analyzer could not have been instantiated.public Configuration getConfig()
Configurable
getConfig
in interface Configurable
public boolean exists()
DBObject
exists
in interface DBObject
public boolean create() throws DBException
create
in interface DBObject
DBException
- The was low-level IOException that prevented index
from creating resources.
DuplicateIndexException
- Parent collection already has full text indexpublic boolean open() throws DBException
DBObject
open
in interface DBObject
DBException
- if operation failedpublic boolean isOpened()
DBObject
isOpened
in interface DBObject
public boolean close() throws DBException
DBObject
close
in interface DBObject
DBException
- if operation failedpublic boolean drop() throws DBException
DBObject
drop
in interface DBObject
DBException
- if operation failedpublic String getName()
Named
getName
in interface Named
public void setCollection(Collection collection)
Indexer
setCollection
in interface Indexer
collection
- The owner Collectionpublic org.apache.lucene.analysis.Analyzer getAnalyzer()
public void flush() throws DBException
Indexer
flush
in interface Indexer
DBException
public IndexerEventHandler getIndexerEventHandler()
getIndexerEventHandler
in interface Indexer
IndexerEventHandler
public IndexMatch[] queryMatches(IndexQuery query) throws DBException
Indexer
queryMatches
in interface Indexer
query
- The IndexQuery to use
DBException
public IndexMatch[] queryMatches(org.apache.lucene.search.Query query) throws DBException
Indexer.queryMatches(IndexQuery)
, but accepts compiled Lucene query as
parameter.
query
- Compiled Lucene query.
DBException
- if IOException prevented indexer from executing the query.
|
Xindice API version 1.2m1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |