public abstract class LuceneDataStore extends AbstractSdxObject implements Saveable
SdxObject.ConfigurationNode| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ALL_FIELD
The field used to search for all documents.
|
static java.lang.String |
ALL_VALUE
Value for the all field
|
protected org.apache.lucene.analysis.Analyzer |
analyzer
The analyzer for the index behind the datastore
|
protected org.apache.lucene.store.FSDirectory |
fsd
The Lucene filesystem directory where the index is stored.
|
protected java.io.File |
fsdFile
The location of the FSDirectory
|
static java.lang.String |
ID_FIELD
The field name used to store the entity's id.
|
protected org.apache.lucene.search.Searcher |
searcher
The Lucene searcher used for locating entities within the datastore.
|
protected boolean |
useCompoundFiles
Specify if using the compound file format when indexing
|
static java.lang.String |
XML_LANG_FIELD
A field name used to store a xml lang value if desired
|
_configuration, _context, _description, _encoding, _id, _locale, _logger, _manager, _xmlizable_objects, _xmlLang, isToSaxInitializedALL_SAVE_ATTRIB, PATH_ATTRIB, SAVE_DIRECTORY_PARAMDEFAULT_ENCODING| Modifier | Constructor and Description |
|---|---|
|
LuceneDataStore() |
protected |
LuceneDataStore(java.io.File dir) |
| Modifier and Type | Method and Description |
|---|---|
void |
backup(SaveParameters save_config)
Save Lucene files
|
protected void |
delete(java.lang.String docId)
Deletes a document from the index
based upon its id field, marked protected
as it is specfic implementation
|
protected void |
delete(java.lang.String[] docIds)
Deletes documents from the index
based upon their id field, marked protected
as it is specfic implementation
|
void |
delete(org.apache.lucene.index.Term term)
Deletes a document from the index
based upon a term field
|
void |
delete(org.apache.lucene.index.Term[] terms)
List of terms to delete using a single index reader
|
protected void |
finalize()
Ensures that resources are freed
|
protected void |
freeResources()
Free's the resources associated with this data store
USE WITH CARE!
|
protected void |
getFSDirectory(boolean create)
Sets the class field 'fsd' a FSDirectory instance for the fsdFile object
|
protected org.apache.lucene.store.FSDirectory |
getFSDirectory(java.io.File dir,
boolean create) |
java.lang.String |
getIndexPath()
Return's the absolute path for the
directory in which the database resides
|
protected org.apache.lucene.index.IndexReader |
getReader()
Returns an index reader for the current FSDirectory.
|
protected org.apache.lucene.search.Searchable |
getSearcher()
Gets the search class variable
|
protected org.apache.lucene.index.IndexWriter |
getWriter()
Gets an IndexWriter for the current FSDirectory
|
protected org.apache.lucene.index.IndexWriter |
getWriter(boolean create) |
protected org.apache.lucene.index.IndexWriter |
getWriter(org.apache.lucene.store.Directory directory)
Get's an IndexWriter based upon the analyzer class field
and the provided Lucene Directory
|
protected org.apache.lucene.index.IndexWriter |
getWriter(org.apache.lucene.store.Directory directory,
boolean create) |
protected void |
init(boolean create)
Initializes the LuceneDataStore
|
protected boolean |
initToSax()
Init the LinkedHashMap _xmlizable_objects with the objects in order to describ them in XML
|
protected void |
initVolatileObjectsToSax()
Init the LinkedHashMap _xmlizable_volatile_objects with the objects in order to describ them in XML
Some objects need to be refresh each time a toSAX is called
|
boolean |
isUsingCompoundFiles()
Say if Lucene uses the compound files
|
protected void |
optimize()
Optimizeds the index for the current FSDirectory.
|
void |
recycleSearcher()
Recycles the searcher
|
void |
restore(SaveParameters save_config)
Restore Lucene files
|
org.apache.lucene.search.Hits |
search(org.apache.lucene.search.Query q)
Searches the database.
|
org.apache.lucene.search.Hits |
search(org.apache.lucene.search.Query q,
org.apache.lucene.search.Filter f)
Searches the database.
|
long |
size()
Returns the number of entities within this database.
|
void |
verifyIndex()
Ensures we have an index to work with
|
protected void |
write(org.apache.lucene.document.Document lDoc)
Writes a document to the index
|
protected void |
writeLuceneData(LuceneData ld) |
configure, configureDescription, contextualize, enableLogging, getBaseAttributes, getClassNameSuffix, getConfiguration, getContext, getDescription, getEncoding, getId, getLocale, getLog, getServiceManager, getXmlLang, service, setDescription, setEncoding, setId, setLocale, setUpSdxObject, setUpSdxObject, setXmlLang, toSAX, verifyConfigurationResourcesprotected boolean useCompoundFiles
public static final java.lang.String ID_FIELD
public static final java.lang.String ALL_FIELD
public static final java.lang.String ALL_VALUE
public static final java.lang.String XML_LANG_FIELD
protected java.io.File fsdFile
protected org.apache.lucene.store.FSDirectory fsd
protected org.apache.lucene.search.Searcher searcher
protected org.apache.lucene.analysis.Analyzer analyzer
public LuceneDataStore()
protected LuceneDataStore(java.io.File dir)
public java.lang.String getIndexPath()
public boolean isUsingCompoundFiles()
protected void init(boolean create)
throws SDXException
SDXExceptionprotected void getFSDirectory(boolean create)
throws SDXException
SDXExceptionprotected org.apache.lucene.store.FSDirectory getFSDirectory(java.io.File dir,
boolean create)
throws SDXException
SDXExceptionpublic void verifyIndex()
throws SDXException
SDXExceptionpublic void recycleSearcher()
throws SDXException
SDXExceptionprotected org.apache.lucene.index.IndexWriter getWriter()
throws java.io.IOException
java.io.IOExceptionprotected org.apache.lucene.index.IndexWriter getWriter(boolean create)
throws java.io.IOException
java.io.IOExceptionprotected org.apache.lucene.index.IndexWriter getWriter(org.apache.lucene.store.Directory directory)
throws java.io.IOException
directory - The lucene directory for which the writer is desiredjava.io.IOExceptionprotected org.apache.lucene.index.IndexWriter getWriter(org.apache.lucene.store.Directory directory,
boolean create)
throws java.io.IOException
java.io.IOExceptionprotected org.apache.lucene.index.IndexReader getReader()
throws SDXException
SDXExceptionprotected org.apache.lucene.search.Searchable getSearcher()
protected void optimize()
throws SDXException
SDXExceptionprotected void write(org.apache.lucene.document.Document lDoc)
throws SDXException
lDoc - The lucene document to addSDXExceptionprotected void writeLuceneData(LuceneData ld) throws SDXException
SDXExceptionprotected void delete(java.lang.String docId)
throws SDXException
docId - The id of the document to be deletedSDXExceptionprotected void delete(java.lang.String[] docIds)
throws SDXException
docIds - The ids of the document to be deletedSDXExceptionpublic void delete(org.apache.lucene.index.Term term)
throws SDXException
term - The term of the document to be deletedSDXExceptionpublic void delete(org.apache.lucene.index.Term[] terms)
throws SDXException
terms - SDXExceptionprotected void freeResources()
throws java.io.IOException
java.io.IOException - Lucene IOExceptionsprotected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwablepublic org.apache.lucene.search.Hits search(org.apache.lucene.search.Query q)
throws SDXException
q - A Lucene query.SDXExceptionpublic org.apache.lucene.search.Hits search(org.apache.lucene.search.Query q,
org.apache.lucene.search.Filter f)
throws SDXException
q - A Lucene query.SDXExceptionpublic long size()
protected boolean initToSax()
AbstractSdxObjectinitToSax in class AbstractSdxObjectprotected void initVolatileObjectsToSax()
initVolatileObjectsToSax in class AbstractSdxObjectpublic void backup(SaveParameters save_config) throws SDXException
backup in interface SaveableSDXExceptionSaveable.backup(fr.gouv.culture.sdx.utils.save.SaveParameters)public void restore(SaveParameters save_config) throws SDXException
restore in interface SaveableSDXExceptionSaveable.restore(fr.gouv.culture.sdx.utils.save.SaveParameters)Copyright © 2000-2010 Ministere de la culture et de la communication / AJLSM. All Rights Reserved.