Class SearchUtils


  • @Uncommitted
    @Public
    public class SearchUtils
    extends Object
    Utility class around FTS (Full Text Search), and especially handling of the default FTS date format (which corresponds to RFC 3339).
    Since:
    2.3.0
    Author:
    Simon Baslé, Michael Nitschinger
    • Method Detail

      • toFtsUtcString

        public static String toFtsUtcString​(Date date)
        Converts a date to the default string representation in FTS (RFC 3339).
        Parameters:
        date - the Date to convert.
        Returns:
        the RFC 3339 representation of the date, in UTC timezone (eg. "2016-01-19T14:44:01Z")
      • fromFtsString

        public static Date fromFtsString​(String date)
        Attempts to convert a date string, as returned by the FTS service, into a Date. The FTS service is expected to return date strings in RFC 3339 format, including the timezone information. For example: 2016-01-10T14:44:01-08:00 for a date in the UTC-8/PDT timezone.
        Parameters:
        date - the date in RFC 3339 format.
        Returns:
        the corresponding Date.
        Throws:
        CouchbaseException - when the date could not be parsed.