Problem/Motivation
We've got a situation where the autocomplete functionality is returning a lot of duplicates. The longer the string is, the more duplicates; in some cases, you can enter something like "opening hours" and get around 5-10 duplicates of "opening hours".
Steps to reproduce
This would depend on your Funnelback installation, and the site/s that it indexes, but entering any sufficiently long search string into a Funnelback-powered search bar with autocomplete might produce duplicates.
Proposed resolution
Apply a change to FunnelbackPageController::getAutocompletionResult that filters out duplicated search suggestions. Something like, say, $results = array_unique(array_map(fn($result) => $result['key'], $results)); to filter down $results to just the list of suggestions.
Remaining tasks
Implement change and test.
User interface changes
None. Reduction of duplicates might mean that users running autocomplete suggestion searches may not receive as many results as are configured in the back end.
API changes
None.
Data model changes
None.
Issue fork funnelback-3438016
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
geoffreyr commentedComment #4
geoffreyr commentedDoesn't handle boolean results properly. Need to fix.
Comment #5
geoffreyr commentedOk, looks like I've fixed the exception throwing.
Comment #7
geoffreyr commentedTargetting to 2.0.0-beta4.