Date Comparisons
A date comparison is a specialized version of a simple query, where the query text string is compared against a single field that must be of type date. Using this specialized comparison for dates is generally preferable to an ordinary simple query comparison, since the inexact matching employed in the specialized version is tuned for the particular structure exhibited by date values. In addition, the specialized date comparison recognizes a wide variety of date formats, making the comparison more robust and tolerant of variations. Like the simple and cognate comparisons, the date comparison outputs a match score between 0.0 and 1.0, and it can be combined with other kinds of queries in more complex query structures.
For date comparisons, the query must be a valid date or the query is rejected. However, if the date in the record is empty, as in the other query types, the "empty score" is returned. As in the other query types, the empty score defaults to 0.0 and can be set to any value between 0.0 and 1.0. For date comparisons, there is an additional possibility, the value might be non-empty but an invalid date value. For example, a value of "None" cannot be interpreted as a date, so no comparison can be made. In this case, the "invalid score" is assigned. Its behavior is the same as the "empty score", it defaults to 0.0 and can be set to any preferred value. Separate scores are provided as an "empty" field might have an entirely different connotation than an "invalid" field. Separate values for these cases allow them to be distinguished and treated differently in matching.
Date comparisons must be made against a field of type date (searchable or non-searchable). For both searchable and non-searchable date fields, the query scoring is the same. A difference in behavior between searchable and non-searchable date fields exists only in the initial, prefilter, record selection phase. If the query is run on a searchable date field, the initial record selection phase can use the query date value to aid in record selection. If the field is non-searchable, the query date value cannot be used in the preliminary record selection. The use of searchable date fields has two important consequences:
| • | The initial record selection is more accurate. With the extra data from the date value in the query the initial record selection can do a better job, resulting in fewer missed matches. |
| • | The query date counts as "fuzzy match" data. Every query must have some fuzzy match data. A single date query on a non-searchable date field is rejected because it lacks fuzzy match data for the initial record selection. A single date query on a searchable date field is valid as it provides "fuzzy match" data for the initial record selection phase. |
The cost for using searchable date fields is increased memory usage to store the indexing data.