seperman / fast-autocomplete

Fast Autocomplete: When Elastcsearch suggestions are not fast and flexible enough
MIT License
271 stars 40 forks source link

Autocomplete not working properly #40

Closed azayz closed 2 years ago

azayz commented 2 years ago

Hello, so I am trying fast autocomplete library and I'm using the following code:

from fast_autocomplete import AutoComplete

words = {'loading': {}, 'loader': {}, 'arrow': {}, 'success': {}, 'confetti': {}, 'background': {}, 'login': {}, '404': {}, 'money': {}, 'car': {}}
autocomplete = AutoComplete(words=words)
print(autocomplete.words)
print(autocomplete.search(word='b', max_cost=3, size=3))
print(autocomplete.search(word='s', max_cost=3, size=3))
print(autocomplete.search(word='ca', max_cost=3, size=3))
print(autocomplete.search(word='lo', max_cost=3, size=3))

and receiving the following output:

{'loading': {}, 'loader': {}, 'arrow': {}, 'success': {}, 'confetti': {}, 'background': {}, 'login': {}, '404': {}, 'money': {}, 'car': {}}
[]
[]
[]
[]

I was expecting to get background in the first result, success in the second result, car in the third and login , loading in the fourth result but all I get is empty lists, is there anything I am missing or are there any tweaks in the configuration to be done ?