Package com.jalios.jcms.search
Class LuceneUtils
- java.lang.Object
-
- com.jalios.jcms.search.LuceneUtils
-
public abstract class LuceneUtils extends java.lang.Object
Provide misc utility when working with lucene- Since:
- jcms-8.0.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.apache.lucene.store.FSDirectory
openAndCheckDirectory(org.apache.log4j.Logger logger, java.io.File dir)
Open the FSDirectory corresponding to the specified directory.static void
writeErrorWitnessFile(java.io.File witnessFile, java.lang.Exception ex)
Write the specified exception to the specified witness file
-
-
-
Method Detail
-
openAndCheckDirectory
public static org.apache.lucene.store.FSDirectory openAndCheckDirectory(org.apache.log4j.Logger logger, java.io.File dir) throws java.lang.Exception
Open the FSDirectory corresponding to the specified directory. This method :- deletes any existing lock when
search-engine.simple-fs-lock: true
was configured. - creates a new index if required
- or check integrity of an existing index if any. If an exception occurs
during this verification, and self recovery is enabled (
search-engine.self-recovery: true
), this method attempts to rename the existing engine directory to a backup folder using the current date, and attempt the creation of a new empty index.
- Parameters:
logger
- the Logger to use to print info/warn messagesdir
- the filesystem directory that should contain the lucene index- Returns:
- a instance of FSDirectory opened and ready for use, never return null
- Throws:
java.io.IOException
java.lang.Exception
- Since:
- 10.0.8 / JCMS-10640
- deletes any existing lock when
-
writeErrorWitnessFile
public static void writeErrorWitnessFile(java.io.File witnessFile, java.lang.Exception ex)
Write the specified exception to the specified witness file- Parameters:
witnessFile
- a File to which write the exceptionex
- the exception to write- Since:
- 10.0.8 / JCMS-10258
-
-