Inconsistent results with FilterForVisitor()

Vote:
 

Hello,

We have been using the same code for many months to search for products in our catalog. Recently though we started having issues where the same search query would produce different results. Sometimes the results are correct, but a lot of the time they are wrong as the results do not include products that should be there. This happens both through our production and dev indexes. I went through our code and setup some tests and found out that FilterForVisitor() was causing the issues. Once I took that out, the results became consistent, but we need this because, as I have read, it filters out unpublished products.

I am not sure what might have changed in our environments to cause FilterForVisitor() to stop working, but any guidance would be highly appreaciated.

Thanks

#194934
Jul 09, 2018 16:01
Vote:
 

Hi Brian,

We had a similar issue where products would periodically disappear from the results of Find queries. Have you compared the structure of the JSON data in Find for a visible product vs a non-visible product? When I did that I found that there were several properties which were missing from the JSON of the missing products as though they had been indexed differently from the others. We found that manually running the content indexing job would resolve the issue temporarily but the problem would eventually come back.

Ultimately this was something that we needed to raise with Episerver support who, on investigation, concluded that the issue was related to a bug in New Relic which was causing an issue in Episerver's initialisation which was knocking out the Find commerce indexing in some way. Their solution was to restart the site which seems to have resolved the issue though I suspect they may have made some changes behind the scenes as the issue was ongoing for a few days during which time I would have expected all application pools to have recycled of their own accord which should have given the same effect.

Hope that helps.

#194981
Jul 10, 2018 13:12
Vote:
 

Hmm that is interesting. Our servers have been restarted many times since the bug started appearing and the content has been re-indexed. It was hard to see difference between products that were visibile because sometimes all the products come back, and then sometimes none of them came back.

I put in a work around since the only reason we need FilterForVisitor() is to filter unpublished items, so I replaced it with the following:

.Filter(x => x.StartPublish.Before(DateTime.UtcNow))
.Filter(x => x.StopPublish.After(DateTime.UtcNow))
#194984
Jul 10, 2018 15:05
Vote:
 

Hi Brian,

We have also came across similar issue. FilterForVisitor() has started creating issue after the EPiServer commerce upgrade from 11.0 to version 11.2.3. We also found some work around.

We are also getting incorrect data from FIND infact the old content is being indexed, we are working with EPiServer support team for the permenent fix.


                        
#207188
Sep 12, 2019 10:10