scout-extended icon indicating copy to clipboard operation
scout-extended copied to clipboard

Incorrect number of results returned when using offset and length attributes

Open dniccum opened this issue 5 years ago • 4 comments

I am currently encountering an issue where the incorrect number of results are being returned. Using the code below, I am requesting 20 results to be returned. However after several different attempts, it appears that Algolia is only returning 19 results.

\App\Configuration::search('jersey')
            ->where('created_by', 25)
            ->with([
                'offset' => 20,
                'length' => 20,
            ])
            ->get()

I have also used the following code with the same result:

\App\Configuration::search('jersey')
            ->where('created_by', 25)
            ->with([
                'hitsPerPage' => 20
            ])
            ->get()

dniccum avatar Jan 10 '20 17:01 dniccum

Hi there. I am a beginner and I wondered if I can do anything about this problem. Can you explain a little about the error place in the code?

sarabisohrab avatar Jan 10 '20 20:01 sarabisohrab

@sarabisohrab Thanks for trying to help! Let's wait for @dniccum feedback. Let me know if you need any help!

nunomaduro avatar Jan 10 '20 21:01 nunomaduro

@sarabisohrab Thanks for trying to help! Let's wait for @dniccum feedback. Let me know if you need any help! Thanks a lot. I'll be happy if I can do even a little thing about this.

sarabisohrab avatar Jan 11 '20 07:01 sarabisohrab

@sarabisohrab The error in question is the fact that I am requesting 20 results from Algolia and only receiving 19 as I indicated in the original post; using 'length' => 20 and 'hitsPerPage' => 20 (which is essentially the same thing).

dniccum avatar Jan 13 '20 14:01 dniccum