Not sure whether I fully understood the problem you face. Especially on “getting all the pages in return part.”
There is an option like, ““includeLocations”: true” which you can try in the search request which would return the array_positions of the search term occurrences inside the document.
In this case, the array position would indirectly tell you the page number information.
for eg:
that sounds great, but I don’t find any documentation on this includeLocations options, how could I add this option in my search query??
And for what I’m trying to do :
I have a document with text in it, the page separator is defined by a page. All i’m trying to do is wanting to show at what page i’va found the word. In my example above, if a search for “number” i want the result “Page 1”, if i search for a word that appears on several pages i want to show all these pages…