Skip to content

Add phrase match weights for full-query ranking - #15863

Closed
adnankussair wants to merge 1 commit into
statamic:6.xfrom
adnankussair:phrase-match-weights
Closed

adnankussair wants to merge 1 commit into
statamic:6.xfrom
adnankussair:phrase-match-weights

Conversation

@adnankussair

Copy link
Copy Markdown

Summary

  • Add phrase and phrase_start match weights to Comb. They count only when a query chunk contains a space, so a field that contains or starts with the full query can be ranked on its own.
  • Both default to 0, so existing scores stay the same until a site sets them.
  • partial_whole and partial_whole_start are unchanged and still count every query word.

Test plan

  • tests/Search/CombTest.php: default phrase and phrase_start are 0, and setting them to 0 leaves scores unchanged
  • With the defaults, a title that repeats some query words outranks a title that contains the full query
  • Raising phrase puts the full-query title first and leaves the repeated-word score unchanged
  • Existing Comb searches still return the same results

Docs: statamic/docs PR lists the two weights next to the existing nine.

Made with Cursor

partial_whole counts every query word, so a repeated word can outrank a field that contains the full query. phrase and phrase_start count only that full query and default to 0.

Co-authored-by: Cursor <cursoragent@cursor.com>
@adnankussair

Copy link
Copy Markdown
Author

Docs: statamic/docs#2026

@adnankussair

Copy link
Copy Markdown
Author

Closing this draft for now. We want Erin to review the Comb change before it goes up as a PR in statamic/cms. The branch stays on the fork for that review.

@adnankussair
adnankussair deleted the phrase-match-weights branch November 12, 2026 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant