foursquare / fsqio

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

autocomplete for state names < 6 characters returns 0 results #26

Closed boriskozak closed 7 years ago

boriskozak commented 7 years ago

When performing an autocomplete lookup for a state name < 6 characters, twofishes can't seem to find any results. I believe this may be because the lookup is done in the prefix index.

Here's an example:

Autocomplete search for Ohio with WoeRestrict 8 (no results)

Autocomplete search for Nebraska with WoeRestrict 8 (returns results as expected)

boriskozak commented 7 years ago

quick update:

I was able to get around this issue by hard coding a short prefix length by changing case Some(prefixMap) if (name.length <= prefixMap.maxPrefixLength) => to case Some(prefixMap) if (name.length <= 3) =>

Still wondering if there's a better way to go about it

boriskozak commented 7 years ago

Another update: I had to roll by my fix above because it caused serious performance degradation.

Any update from the Twofishes team?

mateor commented 7 years ago

I missed your last comment so I thought this was fixed, my apologies. I can pass this along to them for you - although it may not get a response until after the holiday season.

rahulpratapm commented 7 years ago

As of October 2015, we include ADMIN1 names in the prefix index (see https://github.com/foursquare/twofishes/commit/8849521e1c2fbec435db6b14b86d0549845cac32). The index on demo.twofishes.net is older than that, though.

Rather than have the full name index search kick in at 3 characters, which, as you found, will cause perf degradation, I'd suggest you rebuild an index with the latest code.

Also see https://github.com/foursquare/twofishes/issues/28.