Expand rank() operator reference: composite conditions, matches(), negations - #4811
Open
zoharsan wants to merge 1 commit into
Open
Expand rank() operator reference: composite conditions, matches(), negations#4811zoharsan wants to merge 1 commit into
zoharsan wants to merge 1 commit into
Conversation
…gations Document behavior of ranking-only arguments verified against master: - rank() is variadic; arguments after the first never affect matching - all query operators usable in ranking-only arguments (in, range, grouped conditions) - observing arguments with matches(field) and matches(field, n), including several conditions on the same field - grouped conditions are evaluated as a unit (terms expose match information only where the whole condition is true) - negation-only arguments are not observable by rank features; documented the invert-in-the-expression alternative - note on unused ranking-only arguments being pruned (no cost, no effect) Replaces the hybrid-search example with a worked boost example, as the section now focuses on the boost-without-filtering use case. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
bratseth
reviewed
Jul 31, 2026
bratseth
left a comment
Member
There was a problem hiding this comment.
This is a reference document, the purpose of those is to document every element of the topic in question. Explanation of how to use features should instead go into guide documents (anything outside the reference/ directory). Maybe this belongs in the text matching guide?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Expands the
rankoperator section inen/reference/querying/yql.html, which previously only stated the first-argument-matches rule with two examples. Prompted by a customer case about boosting on filter criteria without re-writing the filter logic in rank expressions, where the current documentation left the key questions unanswered.New content, each with a YQL example and the matching rank profile:
in, ranges, grouped conditions).matches(field)as the match indicator;in/ranges are visible tomatches()but not to text features likebm25.matches(field, n)with term numbering, including the caveat that indexes follow query structure.The hybrid-search/
nearestNeighborexample was replaced by a worked boost example, since the section now centers on the boost-without-filtering use case.Verification
All documented behavior was verified against master (
vespaengine/vespa:latest, July 2026) with a minimal test application — every example pattern in the section has a corresponding live query result. Key implementation anchors:searchlib/src/vespa/searchlib/queryeval/multisearch.cpp(doUnpackonly unpacks a child that matches the docid)searchlib/src/vespa/searchlib/queryeval/andnotsearch.cpp(doUnpackunpacks the positive child only)RankBlueprint::createIntermediateSearchinsearchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cppmatches(field, n)numbering (verified empirically)For reviewers
This promotes currently-undocumented implementation behavior (unit evaluation, negation invisibility, pruning) to documented behavior — flagging for search-core owners to confirm these are semantics we want to commit to.
🤖 Generated with Claude Code