Class LuceneUtils


  • public class LuceneUtils
    extends Object
    Lucene utils
    Author:
    Andy
    • Constructor Detail

      • LuceneUtils

        public LuceneUtils()
    • Method Detail

      • getLuceneDateString

        public static String getLuceneDateString​(Date date)
        Returns a date string in the format required by Lucene.
        Since:
        4.0
      • createDateRangeQuery

        public static String createDateRangeQuery​(Date fromDate,
                                                  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:
        NullPointerException - if dateProperty is null or if the dateProperty is not recognised by the system.
        IllegalArgumentException - if dateProperty refers to a property that is not of type DataTypeDefinition.DATE or DataTypeDefinition.DATETIME.