Allow combining filtering fields in autocomplete results too

Created on 13 December 2019, about 5 years ago
Updated 27 March 2024, 9 months ago

Problem

The autocomplete results displaying only the field which matching the entered string by a user.

E.g., we have a filter created to combine user name and surname fields. But autocomplete includes only one field (name or surname) in the suggestions depending on the entered value. It would be useful if the filter includes both fields in the autocomplete suggestions.

Proposed resolution

Add additional settings "Autocomplete combine results" to the filter settings form to allow users to choose to combine fields on the suggestions or not. Make it disabled by default.

✨ Feature request
Status

Needs work

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine Oleksiy Lutsk πŸ‡ΊπŸ‡¦

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡΅πŸ‡ΉPortugal rfmarcelino

    Re-roll #15

  • πŸ‡΅πŸ‡ΉPortugal rfmarcelino

    Re-roll #15 (and #16)

  • πŸ‡·πŸ‡΄Romania vasike Ramnicu Valcea

    As this is features request, let's move it to the latest branch/version.

    And let's see what are the results of the patch.

    p.s. btw is tha patch still applies to the latest? small update today?

    p.s.2: thanks a lot for the efforts

  • πŸ‡ΊπŸ‡ΈUnited States nessthehero

    Just chiming in that the patch in #18 works for 2.x on a Drupal 10.1 install. This is exactly what I needed!

  • Status changed to Needs work 11 months ago
  • πŸ‡·πŸ‡΄Romania vasike Ramnicu Valcea

    Unfortunately, this doesn't work ... yet

    2 things:

    1. The latest patches miss the updates mention at #16 and they were included in that patch (but it was based on a previous version of the module)

    So we need something like

          if ($key === 'views.filter.combine') {
            $definitions[$key]['mapping']['expose']['mapping']['autocomplete_combine_results'] = [
              'type' => 'integer',
              'label' => 'Autocomplete combine results',
            ];
            $definitions[$key]['mapping']['expose']['mapping']['autocomplete_combine_results_delimiter'] = [
              'type' => 'string',
              'label' => 'Autocomplete combine results delimiter',
            ];
          }
    

    in function views_autocomplete_filters_config_schema_info_alter hook

    And 2. Most important - the filter won't work
    So for example we have Test some title title and a Testname username
    Searching for test we can get results/suggestions like
    - Test some title + admin
    - Other title + Testname
    And select any of those options the results will be "empty" as those values do not exist.

    In terms for this to work we'll need for the filter to "split back the suggestion" so it actually returns proper results.

    But not sure how it could be done to work on any scenario.

  • πŸ‡§πŸ‡ͺBelgium weseze

    Patch nog longer applies to 2.0.1.

Production build 0.71.5 2024