I’m trying to implement an autocomplete feature. I have data with repeating names; for example, let’s consider name like “Australia”, “Harbour Bridge Australia”, and many other entries with Australia. Also, I have other entries like “Austin”, “Austria”, etc.
Now I want to extract relevant terms. Let’s say my input query is “Au”. The suggestion I am expecting is a unique combination of names like Australia, Austin and Austria.
I have set up a MongoDB Atlas Search Index for this feature. However, the result I am getting is all the suggestion that matches the “Au” keyword, which I think is expected as this is basically the title that I have in the database.
So is there a way of doing this and getting only the relevant search results and not suggesting “Harbour Bridge Australia” initially and only suggesting once it is the obvious query “Austr”
Any insights, or guidance on best practices for implementing this feature would be greatly appreciated.