I'm building a facet with a filter (in a nested structure). The facet with filter stops to work randomlly.
f => f.PriceIsSellable.Match(true) & f.Currency.Match(filter.Currency) & f.CountryCodes.Match(filter.Country) & f.ValidFrom.Before(DateTime.UtcNow) &f.ValidTo.After(DateTime.UtcNow)
Debugging the problem is with the filter fGbp.ValidFrom.Before(DateTime.UtcNow). I've checked the data in the index and there is no obvious reason that I can see why it breaks. Clearning the index and rebuild seems to fix the issue for the time being.
We are using EPiServer Find version 10.1.0.3493
Thanks in advance
Some kind of caching problem maybe? Possible to run without cache and try?
thanks for replying. The search query is without caching.
Worth to mention that changing the filter to f.ValidFrom.InRange(DateTime.MinValue, DateTime.MaxValue still have the same result (returning no facets).
Can you check if you by accident index null values? Range/before/after will not match a null/non existant value.
Not an answer to the original question, but in case you are going to cache this using StaticallyCacheFor - make sure that you are not using DateTime.Now / DateTime.UtcNow as this will create unique queries for every second passed :-)
@Henrik, all our dates have values. If the validTo date is not set in the CMS/Commerce, we set it to the max date.
@Per, thanks for the heads up :-)!
I've renamed the ValidFrom and ValidTo fields to PriceValidFrom and PriceValidTo. Its been a week and not problems yet (fingers crossed :-)
I'm not sure why it makes a difference, but though it worth to mention.