|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object fr.gouv.culture.sdx.utils.AbstractSdxObject fr.gouv.culture.sdx.utils.lucene.LuceneDataStore
public abstract class LuceneDataStore
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface fr.gouv.culture.sdx.utils.SdxObject |
---|
SdxObject.ConfigurationNode |
Field Summary | |
---|---|
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 |
Fields inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject |
---|
_configuration, _context, _description, _encoding, _id, _locale, _logger, _manager, _xmlizable_objects, _xmlLang, isToSaxInitialized |
Fields inherited from interface fr.gouv.culture.sdx.utils.save.Saveable |
---|
ALL_SAVE_ATTRIB, PATH_ATTRIB, SAVE_DIRECTORY_PARAM |
Fields inherited from interface fr.gouv.culture.sdx.utils.Encodable |
---|
DEFAULT_ENCODING |
Constructor Summary | |
---|---|
|
LuceneDataStore()
|
protected |
LuceneDataStore(java.io.File dir)
|
Method Summary | |
---|---|
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)
|
Methods inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject |
---|
configure, configureDescription, contextualize, enableLogging, getBaseAttributes, getClassNameSuffix, getConfiguration, getContext, getDescription, getEncoding, getId, getLocale, getLog, getServiceManager, getXmlLang, service, setDescription, setEncoding, setId, setLocale, setUpSdxObject, setUpSdxObject, setXmlLang, toSAX, verifyConfigurationResources |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected 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
Constructor Detail |
---|
public LuceneDataStore()
protected LuceneDataStore(java.io.File dir)
Method Detail |
---|
public java.lang.String getIndexPath()
public boolean isUsingCompoundFiles()
protected void init(boolean create) throws SDXException
SDXException
protected void getFSDirectory(boolean create) throws SDXException
SDXException
protected org.apache.lucene.store.FSDirectory getFSDirectory(java.io.File dir, boolean create) throws SDXException
SDXException
public void verifyIndex() throws SDXException
SDXException
public void recycleSearcher() throws SDXException
SDXException
protected org.apache.lucene.index.IndexWriter getWriter() throws java.io.IOException
java.io.IOException
protected org.apache.lucene.index.IndexWriter getWriter(boolean create) throws java.io.IOException
java.io.IOException
protected 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 desired
java.io.IOException
protected org.apache.lucene.index.IndexWriter getWriter(org.apache.lucene.store.Directory directory, boolean create) throws java.io.IOException
java.io.IOException
protected org.apache.lucene.index.IndexReader getReader() throws SDXException
SDXException
protected org.apache.lucene.search.Searchable getSearcher()
protected void optimize() throws SDXException
SDXException
protected void write(org.apache.lucene.document.Document lDoc) throws SDXException
lDoc
- The lucene document to add
SDXException
protected void writeLuceneData(LuceneData ld) throws SDXException
SDXException
protected void delete(java.lang.String docId) throws SDXException
docId
- The id of the document to be deleted
SDXException
protected void delete(java.lang.String[] docIds) throws SDXException
docIds
- The ids of the document to be deleted
SDXException
public void delete(org.apache.lucene.index.Term term) throws SDXException
term
- The term of the document to be deleted
SDXException
public void delete(org.apache.lucene.index.Term[] terms) throws SDXException
terms
-
SDXException
protected void freeResources() throws java.io.IOException
java.io.IOException
- Lucene IOExceptionsprotected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public org.apache.lucene.search.Hits search(org.apache.lucene.search.Query q) throws SDXException
q
- A Lucene query.
SDXException
public org.apache.lucene.search.Hits search(org.apache.lucene.search.Query q, org.apache.lucene.search.Filter f) throws SDXException
q
- A Lucene query.
SDXException
public long size()
protected boolean initToSax()
AbstractSdxObject
initToSax
in class AbstractSdxObject
protected void initVolatileObjectsToSax()
initVolatileObjectsToSax
in class AbstractSdxObject
public void backup(SaveParameters save_config) throws SDXException
backup
in interface Saveable
SDXException
Saveable.backup(fr.gouv.culture.sdx.utils.save.SaveParameters)
public void restore(SaveParameters save_config) throws SDXException
restore
in interface Saveable
SDXException
Saveable.restore(fr.gouv.culture.sdx.utils.save.SaveParameters)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |