Skip to content

support for synonym_match_score#2835

Open
krunal1313 wants to merge 1 commit intotypesense:v31from
krunal1313:synonym_score
Open

support for synonym_match_score#2835
krunal1313 wants to merge 1 commit intotypesense:v31from
krunal1313:synonym_score

Conversation

@krunal1313
Copy link
Copy Markdown
Contributor

Change Summary

Synonym Match Score

synonym_match_score is a per-hit signal returned inside text_match_info for text search results.

It indicates whether a hit matched through a synonym rewrite, and whether synonym prefix matching was involved.

Values

  • 0: the hit did not come from a synonym rewrite
  • 1: the hit came from a synonym rewrite without synonym prefix matching
  • 2: the hit came from a synonym rewrite with synonym_prefix=true

The response also includes:

  • synonym_match: boolean for synonym_match_score > 0

Response

Example:

{
  "document": {
    "id": "1",
    "title": "Cool Trousers"
  },
  "text_match": 578730123373578267,
  "text_match_info": {
    "score": "578730123373578267",
    "tokens_matched": 1,
    "fields_matched": 1,
    "best_field_score": "1108091342849",
    "best_field_weight": 1,
    "num_tokens_dropped": 0,
    "typo_prefix_score": 0,
    "synonym_match_score": 1,
    "synonym_match": true
  }
}

Notes

  • This signal is metadata only. It does not change the existing ranking behavior by itself.
  • synonym_match_score=2 means the hit was produced from the synonym search path with synonym prefix matching enabled.
  • A result that could also match directly may still be marked as a synonym match if the winning hit came from the synonym rewrite path.

PR Checklist

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