I’m having trouble visualising this but is the structure of the page items for page 1 and page 2 somewhat like the below high level examples:
(I have just grouped up the page items for example purposes to help clarify)
Page 1 (11 documents):
1. "sponsored" : true /// The "one out of many" sponsored:true document you have taken to the top
2 - 11. "sponsored" : ... /// I presume the values here don't matter. Correct me if I am wrong here.
Page 2 (9 documents):
12 - 20. "`sponsored" : ... /// I presume the values here don't matter. Correct me if I am wrong here.
I am wondering if the application logic could be altered to achieve what you are after. However, I would need more information for this. Can you provide the following information:
- MongoDB Version.
- Search index details.
- 4-5 sample documents.
- The expected / desired output.
- Output from the
$search
stage whilst highlighting which document wheresponsored
:true
you wish to have moved to the top (e.g. if there are multiple documents in the result set withsponsored:true
, which one should go to the top? The highest scoring, or a random one) - Confirmation that the page structures is as I mentioned initially in this reply.
Regards,
Jason