Skip to content

Search alias for identifiers does not enforce scheme + value on the same identifier #3388

@TahaKhan998

Description

@TahaKhan998

The current implementation of search aliases using SearchFieldTransformer only remaps the field name (e.g. cds:12345 → metadata.identifiers.identifier:12345) without preserving the relationship between the identifier scheme and its value.

After transformation, the query is converted back into a flat query_string, rather than a nested query. As a result, even if both scheme and identifier conditions are present, they are applied at the record level and not constrained to the same identifier entry.

For example, given a record with:

{scheme: "cds", identifier: "2633033"}
{scheme: "inspire", identifier: "12345"}

A query like cds:12345 (or an equivalent combination of scheme and identifier conditions) can incorrectly match this record. This happens because the query effectively checks for:

any identifier with scheme = cds, and
any identifier with identifier = 12345

without ensuring that both conditions apply to the same identifier object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendBackend related issuebugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions