Add per-query field boost directives to lexical search#2472
Draft
Mbeaulne wants to merge 1 commit into
Draft
Conversation
This was referenced Jun 29, 2026
🎩 PreviewA preview build has been created at: |
Collaborator
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
cdd3ff0 to
23eb21c
Compare
98ec0d9 to
d212ea0
Compare
23eb21c to
84aa8ca
Compare
84aa8ca to
dbf3739
Compare
d212ea0 to
5a0dd13
Compare
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.

Description
Adds support for per-query field boost directives in the lexical search syntax. Users can now include bracket expressions (e.g.,
upload [metadata^20]orupload [metadata+10, title-5]) in their search queries to dynamically adjust how much weight individual fields contribute to scoring for that specific query.Supported operator formats within
[...]blocks:^N— multiply the field's base weight by N=N— set the field weight to an absolute value+/++/+++— increment weight by the number of+characters-/--/---— decrement weight by the number of-characters+N/-N— add or subtract a numeric valueField aliases are supported (e.g.,
title→name,desc→description,impl→implementation,input/output→io,meta→metadata).Phrase bonuses are scaled proportionally to the adjusted field weights, keeping scoring consistent. Boost blocks are stripped from the query text before token parsing so they do not interfere with term matching.
Related Issue and Pull requests
Type of Change
Checklist
Screenshots (if applicable)
Test Instructions
npm test(or equivalent) and confirm the new"supports per-query field boosts in bracket directives"test passes alongside existing lexical search tests.upload [metadata^20]and verify that results with matching metadata rank above results that only match on name/title.Additional Comments
The field weight overrides are scoped entirely to the parsed query and do not mutate the global
FIELD_WEIGHTSconstant.