org.alfresco.repo.search.impl.lucene
Class LuceneUtils
java.lang.Object
org.alfresco.repo.search.impl.lucene.LuceneUtils
public class LuceneUtils
- extends java.lang.Object
Lucene utils
Method Summary |
static java.lang.String |
createDateRangeQuery(java.util.Date fromDate,
java.util.Date toDate,
QName dateProperty,
DictionaryService dictionaryService,
NamespaceService namespaceService)
This method creates a Lucene query fragment which constrains the specified dateProperty to a range
given by the fromDate and toDate parameters. |
static boolean |
fieldHasTerm(org.apache.lucene.index.IndexReader indexReader,
java.lang.String field)
|
static java.lang.String |
getLuceneDateString(java.util.Date date)
Returns a date string in the format required by Lucene. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LuceneUtils
public LuceneUtils()
fieldHasTerm
public static boolean fieldHasTerm(org.apache.lucene.index.IndexReader indexReader,
java.lang.String field)
getLuceneDateString
public static java.lang.String getLuceneDateString(java.util.Date date)
- Returns a date string in the format required by Lucene.
- Since:
- 4.0
createDateRangeQuery
public static java.lang.String createDateRangeQuery(java.util.Date fromDate,
java.util.Date toDate,
QName dateProperty,
DictionaryService dictionaryService,
NamespaceService namespaceService)
- This method creates a Lucene query fragment which constrains the specified dateProperty to a range
given by the fromDate and toDate parameters.
- Parameters:
fromDate
- the start of the date range (defaults to 1970-01-01 00:00:00 if null).toDate
- the end of the date range (defaults to 3000-12-31 00:00:00 if null).dateProperty
- the Alfresco property value to check against the range (must be a valid Date or DateTime property).
- Returns:
- the Lucene query fragment.
- Throws:
java.lang.NullPointerException
- if dateProperty is null or if the dateProperty is not recognised by the system.
java.lang.IllegalArgumentException
- if dateProperty refers to a property that is not of type DataTypeDefinition.DATE
or DataTypeDefinition.DATETIME
.
Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.