Date/Time Parsers
Custom date/time parsers can be specified to allow matches to be made across date/time formats.
The Search Service expects dates to be in the format specified by RFC-3339 , which is a specific profile of ISO-8601. Since Search queries need to specify dates in RFC-3339 format, the dates that are stored in Full Text Indexes also need to be in RFC-3339 format.
A date/time parser tells the Search Service ahead of time what the date/time layout of a field will be. If the Type of a child field is set to datetime
, and the time layout(s) found in that field is not in RFC-3339 format, then you can specify a custom date/time parser that contains the layouts that the Search Service is to expect.
To add a custom date/time parser to a Full Text Index via the Couchbase Capella UI, the following permissions are required:
-
You must have
Project View
privileges for the project that contains the cluster. -
You must have a database user associated with your organization user account. The database user must have Read/Write permissions for the bucket on which the index was created.
-
Date/time parsers can be viewed and modified from the index’s configuration page, under the Index Settings section.
Any date/time parsers that are configured for the current index can be viewed by expanding the Date/Time Parsers panel. If no date/time parsers have been configured for the index, the Date/Time Parsers panel will be empty.
Add Date/Time Parsers
Date/Time Parsers can be specified to allow matches to be made across different formats:
To add the date/time parser
Left click the + Add Date/Time Parser
The Customer Date/Time Parser dialog appears.
Enter a suitable name for the custom parser into the Name field.
Left-click on the + Add button to successively add the layouts for the parser in the interactive field below the Layouts field, by after each one:
This adds the layout to a list of layouts displayed in the Layouts field.
To remove any of these, select its name in the Layouts field, and left-click on the Remove button. When the list is complete, left-click on the Save button to save.
Documentation on using the Go Programming Language to specify layouts is provided on the page Package time. In particular, see the section func Parse.