Vulnerability in EPiServer.Forms
I am working on FIND 13.2.6. and CMS 11.20.5
I have written a scheduled jobs, in which I get pages from FIND, and put the results in a JSON file.
This is the below FIND query I have -
var query = _searchClient.Service.Search<BasePage>(); query = query .ExcludeDeleted() .CurrentlyPublished() .FilterOnReadAccess() .FilterOnCurrentSite() .AddRelevanceFilter() .Take(1000);
(AddRelevance is a custom filter I have created.)
I have 19000 matching records, and hence I am using paging to retrive the full set i.e 1000 results everytime until 19000 is reached.
But everytime I run this job, the results are inconsistent. For eg. if the article A and B come in the JSON first time, next time they are missing. The count of results remains the same i.e 19000 and the articles are present in FIND index, but they periodically disappear from the query results.
Is there a limit to the query results? Or is it possible that somehow one of the FIND functions is causing inconsistent results? Any suggestions would be helpful!
First thing come to mind: you should apply order to make sure the paging you get everytime is consistent.
Do you have multiple sites? Could issue be related to scheduled job context and the use of .FilterOnCurrentSite() ?
We do have multiple sites. But as Quan suggested, I added orderBy to the query, and haven't seen this issue come up since then!