let say I’m running this simple query in my dataset
and it work fine but I want to show those document on top which match both $OR condition and those which match one condition show on last so for that I want to add score to each document if it match both condition then add score = 2 and if match one condition then score = 1 and then i’ll sort it with score.
but problem is how to calculate score for each document ?
I want my query to return this type of document like:
I read this https://www.mongodb.com/docs/atlas/atlas-search/scoring/
link suggest to create index but I have very long query of $or which match 9 to 10 fields and creating such large compound index is I thing not good so that I don’t wanna create index for that.
can you please help me out from this.
Thank you in advance.