Class DateSearchHelper

java.lang.Object
ch.tocco.nice2.enterprisesearch.impl.searchbuilder.DateSearchHelper

public class DateSearchHelper extends Object
Creates search conditions for dates.

If a date (without time) is given: A range condition is created as follows for each field: field1_dt:[2015-10-20T00:00:00.000Z TO 2015-10-20T23:59:59.999Z]

If a date time is given: A condition is created as follows for each field: field1_dt:"2014-06-11T01:23:12.456Z"

All field conditions are concatenated with an OR conditions.

So that a date gets recognized, it needs to be in one of the following formats: - date time in the DateTimeFormatter.ISO_INSTANT format (e.g. 2014-06-11T01:23:12.456Z) - date in DateTimeFormatter.ISO_LOCAL_DATE format (e.g. 2014-06-11) - date in FormatStyle.MEDIUM style of the given locale (e.g. 11.06.2015 for locale de-CH) - date in FormatStyle.SHORT style of the given locale (e.g. 11.06.15 for locale de-CH)

This class uses the java time api to parse the search input because the joda time parser parses also numbers like "123" to a LocalDate or DateTime.

  • Constructor Details

    • DateSearchHelper

      public DateSearchHelper(Locale locale)
  • Method Details