Filter duplicates out of autocomplete results

Created on 4 April 2024, 8 months ago
Updated 14 June 2024, 5 months ago

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.

Feature request
Status

Needs review

Version

2.0

Component

Code

Created by

🇦🇺Australia geoffreyr

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024