FIND query not giving consistent results

Vote:
 

Hi

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!

#256004
Edited, Jun 03, 2021 9:08
Vote:
 

First thing come to mind: you should apply order to make sure the paging you get everytime is consistent. 

#256010
Jun 03, 2021 11:15
Vote:
 

Do you have multiple sites? Could issue be related to scheduled job context and the use of .FilterOnCurrentSite() ?

#260192
Aug 06, 2021 7:42
Vote:
 

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!

#260193
Aug 06, 2021 7:58
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.