Closed tomay closed 10 months ago
The underlying search is handled by Fuse.js, with options passed in from seattle.json
I also just noticed this:
Which indicates it might be doing some kind of a conditional proximity search? When does that come into play?
So we'd want to take that into account before tweaking the Fuse options to just "fix it" for the one reported issue
An additional clue, the Autocomplete library is this: https://github.com/Pixabay/JavaScript-autoComplete
Of course this is ancient, and the demo and documentation website is defunct
From this it looks like "autocomplete" is initially on and responding to keyup, and that uses Fuse to search building data.
But if you hit the enter key, it does an address search using the entered term and the search URL specified in seattle.json
(in this case, Nominatim)
In code here: https://github.com/GreenInfo-Network/seattle-building-dashboard/blob/master/src/lib/autocomplete/autocomplete.js#L188-L203
Modified the example using settings from seattle.json
we have:
"location": 0
"distance": 50
"threshold": 0.1
With the above options, for something to be considered a match, it would have to be within (threshold) 0.1 x (distance) 50 = 5 characters away from the expected location 0.
That's never going to match a word near the end of a long string, e.g. "Marriott Residence Inn Convention Center". I think that's 23 characters away
If I change to the following:
"location": 0,
"distance": 80,
"threshold": 0.3,
I do get the result, although it is a good ways down the list of suggestions. At the bottom in fact. Is there some way to give exact matches a higher rank?
I'm going to stick with these values for now and see what the client thinks of the results
Mike reported that search works for exact terms, but not substring matches
For example, searching on "Marriott" turns up two results:
But if I then search on "Convention", that doesn't pick up "Marriott Residence Inn Convention" at all as you would expect: