I’m currently working on a project with a collection of foods. Each food has a name field and I would like to use the Full Text Search capabilities to query the collection. For example, in the collection, there are 3 documents with the exact name “APPLE”. However, there are a few hundred other food documents which contain APPLE in the name field. Some of these documents have “APPLE” show up multiple times in the name. My question is how do I set up a search index and query to prioritize exact matches. So if I want the top 10 results, how do I ensure the 3 documents with exactly “APPLE” as the name show up at the top. To be clear I do not want to do only an exact match. I still want other documents that contain APPLE in it. The exact matches just need to be scored highest. Currently, based off a relevance, documents that contain APPLE in the name multiple times are scored higher.
As we can see, the exact matches appear first followed by the rest.
Please let me know if my understanding is correct here or not. If it’s not working as expected, please post more details such as your search result, index definition, etc. Feel free to reach out for anything else as well.