Open xumix opened 9 years ago
The error is here:
return DateTime.SpecifyKind(DateTime.ParseExact((string) value, format, null), DateTimeKind.Utc);
The value is: 2015-08-15t21:00:00
but the format is yyyy-MM-ddTHH:mm:ss
This is actually a blocker, since datetime fielda are not usable at all
Resolved with .NotAnalyzed() but this looks not intuitive
Now, more problems, the same query finds no documents for the specified dates there are many post about this on SO http://stackoverflow.com/questions/5495645/indexing-and-searching-date-in-lucene my parsed query looks like this:
+(+(+StartDate:[2015-01-01T00:00:00 TO *] +EndDate:[* TO 2016-01-01T00:00:00]) +(HotelName:*чайка* HotelRegionName:*чайка*)) +TypeOfRest:2
If I remove date constraints then there are many items with dates like 2015-09-15T00:00:00
etc.
Finally got it working with .AsNumeric()
Treating dates and times as numeric fields will generally result in faster range queries and is the recommended approach. It sounds like there may be bugs with string based indexing so I'll keep this open until I can look into it.
I have my system configured with ru-RU locale, this is what I get if I try to search within DateTime fields