Skip to content

Autocomplete: show all language matches when searching 'Any language' #1934

@fvogel

Description

@fvogel

Problem

When using the autocomplete search with "Any language" selected, the unique=true parameter is always passed to the REST API. This causes deduplication by URI, keeping only one language match per concept.

For example, searching restaur* with "Any language" in a trilingual vocabulary (EN/FR/ES) returns only 5 Spanish results, hiding 4 French matches for the same concepts:

With unique=true (current) With unique=false (proposed)
5 results (ES only) 9 results (ES + FR)

The French matches (Restaurer 30 % des écosystèmes dégradés, Restaurer, préserver et renforcer..., etc.) are silently dropped because their URIs already appeared in the Spanish results.

Expected behavior

When "Any language" is selected, deduplication should be disabled so all language matches are shown. This is the whole point of "Any language" — to find matches across languages.

When a specific language is selected (e.g. French), unique=true still makes sense since there can't be cross-language duplicates.

Proposed fix

In resource/js/vocab-search.js, make unique conditional on the selected language:

// Current (line 63):
const skosmosSearchUrlParams = new URLSearchParams({ query: this.formatSearchTerm(), unique: true })

// Proposed:
const unique = this.selectedLanguage !== 'all'
const skosmosSearchUrlParams = new URLSearchParams({ query: this.formatSearchTerm(), unique: unique })

The selectedLanguage property is already available at this point in the code (set during mounted()), so no additional plumbing is needed.

Context

Discovered while building a multilingual SKOS vocabulary (EN/FR/ES) for the Kunming-Montreal Global Biodiversity Framework.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions