com.dotmarketing.util
Class LuceneUtils
java.lang.Object
com.dotmarketing.util.LuceneUtils
public class LuceneUtils
- extends java.lang.Object
|
Field Summary |
static java.lang.String[] |
SPECIAL
|
|
Method Summary |
static void |
addDateTerm(BooleanQuery booleanQuery,
java.lang.String field,
java.lang.String text)
|
static void |
addQueryTerm(BooleanQuery booleanQuery,
java.lang.String field,
java.lang.String text)
|
static void |
addRequiredDateTerm(BooleanQuery booleanQuery,
java.lang.String field,
java.lang.String text)
|
static void |
addRequiredQueryTerm(BooleanQuery booleanQuery,
java.lang.String field,
java.lang.String text,
boolean wildcard)
|
static void |
changeToTheNewLuceneDir()
|
static void |
checkAndInitialiazeCurrentIndex()
This is method should be used only at startup to initialize/unblock/create the current lucene index |
static java.lang.String |
escape(java.lang.String text)
|
static java.lang.String |
findAndReplaceQueryDates(java.lang.String query)
|
static java.util.Date |
fromLuceneDate(java.lang.String luceneDate)
|
static java.lang.String |
getCurrentLuceneDirPath()
|
static Field |
getDateField(java.lang.String field)
|
static Field |
getDateField(java.lang.String field,
java.util.Date date)
|
static Field |
getIndexedField(java.lang.String field,
java.lang.String keyword)
|
static Field |
getKeywordField(java.lang.String field,
java.lang.String keyword)
|
static java.lang.String |
getNewLuceneDirPath()
|
static Field |
getUnIndexedField(java.lang.String field,
java.lang.String keyword)
|
static void |
optimizeCurrentIndex()
|
static void |
printIndex()
For debug purposes |
static boolean |
recreateNewIndexFolder()
|
static void |
removeDocByIdenToCurrentIndex(java.lang.String identifier)
|
static void |
removeDocByIdenToReindexationIndex(java.lang.String identifier)
|
static LuceneHits |
searchInCurrentIndex(Query query,
int offset,
int limit,
java.lang.String sortBy)
|
static LuceneHits |
searchInReindexationIndex(Query query,
int offset,
int limit,
java.lang.String sortBy)
|
static java.lang.String |
toLuceneDate(java.util.Date date)
|
static java.lang.String |
toLuceneDate(java.lang.String dateString)
|
static java.lang.String |
toLuceneDateTime(java.lang.String dateString)
|
static java.lang.String |
toLuceneDateWithFormat(java.lang.String dateString,
java.lang.String format)
|
static java.lang.String |
toWildcard(java.lang.String keywords)
|
static void |
writeInodeToCurrentIndex(Document inodeDoc)
|
static void |
writeInodeToReindexationIndex(Document inodeDoc)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SPECIAL
public static final java.lang.String[] SPECIAL
LuceneUtils
public LuceneUtils()
getCurrentLuceneDirPath
public static java.lang.String getCurrentLuceneDirPath()
getNewLuceneDirPath
public static java.lang.String getNewLuceneDirPath()
changeToTheNewLuceneDir
public static void changeToTheNewLuceneDir()
recreateNewIndexFolder
public static boolean recreateNewIndexFolder()
removeDocByIdenToReindexationIndex
public static void removeDocByIdenToReindexationIndex(java.lang.String identifier)
writeInodeToReindexationIndex
public static void writeInodeToReindexationIndex(Document inodeDoc)
removeDocByIdenToCurrentIndex
public static void removeDocByIdenToCurrentIndex(java.lang.String identifier)
writeInodeToCurrentIndex
public static void writeInodeToCurrentIndex(Document inodeDoc)
checkAndInitialiazeCurrentIndex
public static void checkAndInitialiazeCurrentIndex()
- This is method should be used only at startup to initialize/unblock/create the current lucene index
searchInCurrentIndex
public static LuceneHits searchInCurrentIndex(Query query,
int offset,
int limit,
java.lang.String sortBy)
searchInReindexationIndex
public static LuceneHits searchInReindexationIndex(Query query,
int offset,
int limit,
java.lang.String sortBy)
optimizeCurrentIndex
public static void optimizeCurrentIndex()
getDateField
public static Field getDateField(java.lang.String field)
getDateField
public static Field getDateField(java.lang.String field,
java.util.Date date)
getKeywordField
public static Field getKeywordField(java.lang.String field,
java.lang.String keyword)
getIndexedField
public static Field getIndexedField(java.lang.String field,
java.lang.String keyword)
getUnIndexedField
public static Field getUnIndexedField(java.lang.String field,
java.lang.String keyword)
addQueryTerm
public static void addQueryTerm(BooleanQuery booleanQuery,
java.lang.String field,
java.lang.String text)
throws ParseException
- Throws:
ParseException
addRequiredQueryTerm
public static void addRequiredQueryTerm(BooleanQuery booleanQuery,
java.lang.String field,
java.lang.String text,
boolean wildcard)
throws ParseException
- Throws:
ParseException
addRequiredDateTerm
public static void addRequiredDateTerm(BooleanQuery booleanQuery,
java.lang.String field,
java.lang.String text)
throws ParseException
- Throws:
ParseException
addDateTerm
public static void addDateTerm(BooleanQuery booleanQuery,
java.lang.String field,
java.lang.String text)
throws ParseException
- Throws:
ParseException
escape
public static java.lang.String escape(java.lang.String text)
toWildcard
public static java.lang.String toWildcard(java.lang.String keywords)
printIndex
public static void printIndex()
throws java.io.IOException
- For debug purposes
- Throws:
java.io.IOException
toLuceneDateTime
public static java.lang.String toLuceneDateTime(java.lang.String dateString)
toLuceneDate
public static java.lang.String toLuceneDate(java.lang.String dateString)
toLuceneDateWithFormat
public static java.lang.String toLuceneDateWithFormat(java.lang.String dateString,
java.lang.String format)
toLuceneDate
public static java.lang.String toLuceneDate(java.util.Date date)
fromLuceneDate
public static java.util.Date fromLuceneDate(java.lang.String luceneDate)
findAndReplaceQueryDates
public static java.lang.String findAndReplaceQueryDates(java.lang.String query)
Copyright © 2006 Dotmarketing, Inc. All Rights Reserved.