I've inherited a Sitecore site that I'm upgrading from 8.2 to 9.2. I've noticed that the query being built in 9.2 is slightly different to the one in 8.2.
There are two relevant fields that get indexed, Date and EndDate. Date is a DateTime and EndDate is a Nullable[DateTime].
Both the 8.2 and 9.2 indexes are indexing the fields correctly as can be seen here:
However, the query generated by Sitecore is not correct as the tdt is not added to the end of the nullable type, but does work for the struct.
["undefined field: "end_date""]
[(((_template:(3da0703f1b6c4c73825d15218599f485) OR _template:(23e003536083498da8880acd4890b9e4)) AND (-_isstandardvalues_b:(True) :)) AND (date_tdt:[2020-04-26T23:00:00Z TO *] OR end_date:[2020-04-26T23:00:00Z TO *]))]
The exact same code works fine in 8.2, is this a bug or has something changed in 9.2?
addFieldByFieldName
section for your nullable DateTime for type match with nullValue-<fieldType fieldName="end_date" returnType="datetime" nullValue="NULLVALUE" emptyString="EMPTYVALUE"/>
.