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. |
Mbeaulne
force-pushed
the
06-29-fix_production_slowness
branch
2 times, most recently
from
June 29, 2026 18:14
cdd3ff0 to
23eb21c
Compare
Mbeaulne
force-pushed
the
06-29-query_weight_change
branch
2 times, most recently
from
June 29, 2026 18:20
98ec0d9 to
d212ea0
Compare
Mbeaulne
force-pushed
the
06-29-fix_production_slowness
branch
2 times, most recently
from
June 29, 2026 18:38
84aa8ca to
dbf3739
Compare
Mbeaulne
force-pushed
the
06-29-query_weight_change
branch
from
June 29, 2026 18:38
d212ea0 to
5a0dd13
Compare
Mbeaulne
changed the base branch from
06-29-fix_production_slowness
to
graphite-base/2472
June 29, 2026 19:41
Mbeaulne
force-pushed
the
06-29-query_weight_change
branch
from
July 8, 2026 12:43
5a0dd13 to
f0f3c5f
Compare
Mbeaulne
force-pushed
the
graphite-base/2472
branch
from
July 8, 2026 12:43
dbf3739 to
f306696
Compare
Mbeaulne
changed the base branch from
graphite-base/2472
to
06-29-fix_production_slowness
July 8, 2026 12:43
Mbeaulne
changed the base branch from
06-29-fix_production_slowness
to
graphite-base/2472
July 8, 2026 16:41
Mbeaulne
force-pushed
the
graphite-base/2472
branch
from
July 8, 2026 16:46
f306696 to
8674be9
Compare
Mbeaulne
force-pushed
the
06-29-query_weight_change
branch
from
July 8, 2026 16:46
f0f3c5f to
f48e1e3
Compare
Mbeaulne
force-pushed
the
06-29-query_weight_change
branch
from
July 8, 2026 16:47
f48e1e3 to
66f76ec
Compare
| if (!field) return; | ||
|
|
||
| const currentWeight = fieldWeights[field]; | ||
| let nextWeight = currentWeight; |
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.