foursquare / fsqio

A monorepo that holds all of Foursquare's opensource projects
Apache License 2.0
254 stars 54 forks source link

Autocomplete does not work before 6 characters are typed #74

Open YassineALLAL opened 2 years ago

YassineALLAL commented 2 years ago

The twofishes prefix index doesn't seem to be correctly built causing the autocomplete to not work untill 6 characters.

r => bestWoeTypes.contains(r.woeTypeOrThrow) never matches because r.woeTypeOrThrow is an enum while bestWoeTypes is a list of integers (enum ordinals) https://github.com/foursquare/fsqio/blob/f5a5699c18babaa6810de84bcc6dd1522bcfe259/src/jvm/io/fsq/twofishes/indexer/output/PrefixIndexer.scala#L122

A fix would be to remove the map(_.getValue) mapping and keep the enum type. https://github.com/foursquare/fsqio/blob/f5a5699c18babaa6810de84bcc6dd1522bcfe259/src/jvm/io/fsq/twofishes/indexer/output/PrefixIndexer.scala#L103