Build a search suggestion system with millions of search terms with ultrafast query speed. Search Suggestion utilizes complex trie data structures in the background to manage large datasets without compromising speed.
To install Search Suggestion, simply use pip:
pip install search-suggestion
from search_suggestion import SearchSuggestion
ss = SearchSuggestion()
ss.insert('cat')
ss.batch_insert(['car', 'dog'])
result = ss.search('c')
print(result)
> ['cat', 'car']
The number of search results defaults to 10, an optional max_suggestions
can be provided to override this value.
result = ss.search('c', max_suggestions=20)
If you have any requests, please feel free to submit a ticket. I will try to prioritize based on available time.