Update synonyms documentation for Meilisearch#3579
Conversation
Clarified the behavior of synonym handling in Meilisearch, including limitations on term length and maximum synonyms per term.
📝 WalkthroughWalkthroughDocumentation in ChangesSynonym documentation update
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
capabilities/full_text_search/relevancy/synonyms.mdx (1)
183-183: ⚡ Quick winSplit this sentence into two shorter sentences.
This line is dense and harder to scan in docs; splitting it would improve readability without changing meaning.
As per coding guidelines, "Prefer shorter sentences; if a sentence runs over approximately 40 words, consider splitting or simplifying".
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@capabilities/full_text_search/relevancy/synonyms.mdx` at line 183, The sentence explaining the synonym behavior (the example using "lord of the rings" and "lotr") is too long; split it into two shorter, clearer sentences: first state that setting "lord of the rings" as a synonym for "lotr" makes searches for "lotr" return documents containing "lord of the rings", then in a separate sentence note that searching for "lord of the rings" will not return documents containing "lotr" because the search term has more than three words (keep the wording about the 3-word limit). Ensure both sentences appear in the same paragraph in capabilities/full_text_search/relevancy/synonyms.mdx where the original line occurs.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@capabilities/full_text_search/relevancy/synonyms.mdx`:
- Line 183: The sentence explaining the synonym behavior (the example using
"lord of the rings" and "lotr") is too long; split it into two shorter, clearer
sentences: first state that setting "lord of the rings" as a synonym for "lotr"
makes searches for "lotr" return documents containing "lord of the rings", then
in a separate sentence note that searching for "lord of the rings" will not
return documents containing "lotr" because the search term has more than three
words (keep the wording about the 3-word limit). Ensure both sentences appear in
the same paragraph in capabilities/full_text_search/relevancy/synonyms.mdx where
the original line occurs.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a3291a1f-9616-42b1-b7e0-7063d6f71fb1
📒 Files selected for processing (1)
capabilities/full_text_search/relevancy/synonyms.mdx
CaroFG
left a comment
There was a problem hiding this comment.
Thanks a lot for adding this! It's a useful edge case that's easy to miss and good to have documented! I requested a few changes, specifically around the workaround suggestion. I also noticed an unrelated section had been accidentally split into two paragraphs, so I removed the extra spacing.
|
|
||
| For example, if you set `"lord of the rings"` as a synonym for `"lotr"`, searching for `"lotr"` will return documents containing `"lord of the rings"`. However, if you search for `"lord of the rings"`, Meilisearch will not return documents containing `"lotr"` because the search term has more than 3 words. | ||
|
|
||
| This limitation applies regardless of how you configure your synonyms. To work around this, consider using shorter synonym terms or breaking longer phrases into multiple single-word synonyms. |
There was a problem hiding this comment.
| This limitation applies regardless of how you configure your synonyms. To work around this, consider using shorter synonym terms or breaking longer phrases into multiple single-word synonyms. |
The workaround as written would lead to odd configurations like mapping 'of the ring' → 'lotr', which isn't really meaningful. Also, breaking "lord of the rings" into lord, rings etc. as synonyms for 'lotr' would match completely unrelated documents.
There was a problem hiding this comment.
I agree with you. I would prefer not to propose workarounds for now. I'll work on the synonyms storage this week if I have time, and maybe improve the situation around this limitation.
|
|
||
| If you input `SF` as a search query, Meilisearch will also return results containing the phrase `San Francisco`. However, depending on the ranking rules, they might be considered less [relevant](/capabilities/full_text_search/relevancy/relevancy) than those containing `SF`. The reverse is also true: if your query is `San Francisco`, documents containing `San Francisco` may rank higher than those containing `SF`. | ||
| If you input `SF` as a search query, Meilisearch will also return results containing the phrase `San Francisco`. | ||
|
|
| If you input `SF` as a search query, Meilisearch will also return results containing the phrase `San Francisco`. However, depending on the ranking rules, they might be considered less [relevant](/capabilities/full_text_search/relevancy/relevancy) than those containing `SF`. The reverse is also true: if your query is `San Francisco`, documents containing `San Francisco` may rank higher than those containing `SF`. | ||
| If you input `SF` as a search query, Meilisearch will also return results containing the phrase `San Francisco`. | ||
|
|
||
|
|
| If you input `SF` as a search query, Meilisearch will also return results containing the phrase `San Francisco`. | ||
|
|
||
|
|
||
|
|
Kerollmops
left a comment
There was a problem hiding this comment.
Hello @anujagnihotry 👋 Thanks for the PR, would you mind applying the suggestions, please? Have a nice day 🌵
Clarified the behavior of synonym handling in Meilisearch, including limitations on term length and maximum synonyms per term.
Description
Checklist
For internal Meilisearch team member only:
For external maintainers
Summary by CodeRabbit