Skip to content

Support AND semantics for multi-field collapsefield #37200

Description

@mihagazvoda

Is your feature request related to a problem? Please describe.
When collapsing on multiple fields (collapsefield=a,b), the semantics are OR /
independent: a hit is dropped if it matches a higher-ranked hit on either field.
There's no way to express the AND condition — i.e. drop a hit only when it matches
a higher-ranked hit on all listed fields. This matters for result diversity /
dedup cases where two documents should only be considered duplicates if they agree
on every collapse field, not just one.

Describe the solution you'd like
A way to choose AND semantics across multiple collapse fields, so a hit is collapsed
only if it matches a higher-ranked hit on every field in the list (rather than any
single one).

Describe alternatives you've considered
Precomputing a single composite key field (concatenation of a + b) and collapsing
on that. This works but requires a schema change and full reindex.

Additional context
Docs for reference:
https://docs.vespa.ai/en/querying/result-diversity#collapsefield

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions