0

So, I am working on implementing autocomplete feature on MongoDB atlas search, and I have a field in my document which has the score of the particular search-keyword in the document.

Like, This is one of the field

Primary_Search   Hello
Relevant_Meaning Hi
Search_Score     10.66

and this is another

Primary_Search   Hi
Relevant_Meaning Hi
Search_Score     12.66

So both are different searches but have same relevant meaning so, in this case I will show the result with my Score-System which has higher Score.

P.S: I have indexed the collection with Primary_Search and Relevant Meaning as autocomplete type and Search_Score as Number type

  • 1
    If I understood correctly, you want to obtain the same score for both results, but you have only indexed the `Primary_Search`? I would say that you can't do that, but I'm not sure. The thing is you obtain different score results because they're different strings. Anyway, take a look here https://www.mongodb.com/docs/atlas/atlas-search/scoring/ . Maybe you could apply some option in order to alter the final score. Good luck! – biorubenfs Jul 23 '22 at 09:21
  • done the scoring using Function Scoring – ツJediRebellion Jul 26 '22 at 09:14
  • and got the unique values through $group thanks! – ツJediRebellion Jul 26 '22 at 09:35

0 Answers0