Duplicate content returned while paginating


#1

I have 3 data nodes and 2 master nodes. I imported all the content and am using NEST to do simple search. Here is the code for that.

mediaResponse = elastic.Search<Articles>(s => s
                                                           .Explain(true)
                                                           .Pretty(true)
                                                           .Human(true)
                                                           .Index(mediaIndexName)
                                                           .Type(mediaTypeName)
                                                           .From(pageNumber)
                                                           .Size(numResults)
                                                           .Query(q => q
                                                                        .Match(m => m
                                                                                     .Field(new Field("content", null)).Query(queryTxt)
                                                                              )
                                                                 )
            );

When I use my default values (numResults = 25, pageNumber=0) everything is fine but when I use pageNumber=1 I start seeing dupes from page 0 in page 1 result set. Anything I can do to stop this behavior?


(Mark Harwood) #2

"From" is not a page number but a result number e.g. document number 11 in a set of results.
Typically when you page through results you need to add "Size" to the previous "From"


#3

Thank you @Mark_Harwood that solved my issue


(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.