mattermost/mattermost
View on GitHub[Bug]: OR search in Recent Mentions causes false positives
Open
#33,806 opened on Aug 28, 2025
Help Wanted
Description
Before you file a bug report
- I have checked the issue tracker and have not found an issue that matches the one I'm filing.
- This issue is not a troubleshooting question. Troubleshooting questions go here: https://forum.mattermost.com/c/trouble-shoot/16.
- This issue is not a feature request. You can request features and make product suggestions here: https://mattermost.uservoice.com/forums/306457-general/.
- This issue reproduces on one of the currently supported server versions.
- I have read the contribution guidelines and the Mattermost Handbook Contribution Guidelines.
Mattermost Server Version
10.9.0
Operating System
macOS 15.5
Steps to reproduce
- This issue occurs when performing OR searches with multiple usernames.
- Searches with a single username work fine.
- There may be an issue with the search query parsing.
- Affected features: Recent Mentions, general search functionality.
Expected behavior
- Cause of the issue: The is_or_search parameter was not set correctly in the performSearch() function.
- Affected file: webapp/channels/src/actions/views/rhs.ts
- Fix: Set is_or_search to false to change to an AND search.
Observed behavior
OR searches are not handled correctly, and search results differ from what is expected or the search fails.
Log Output
NA
Additional Information
Test Conditions:
- Login user:
user-testlogin01 - Test posts: (all 7posts)
@user-testlogin01 hi@user-testlogin01 is_or_search falsehi all usersuser-456useruser-123@user-12321eb958 hi
Test Results:
1. is_or_search: true (Current behavior)
curl -X POST http://localhost:8065/api/v4/posts/search \
-H "Authorization: Bearer ${TOKEN}" \
-H "Content-Type: application/json" \
-d '{"terms":"@user-testlogin01","is_or_search":true}'
Result: 7 posts (all) returned
- ✗ All posts containing "user" were matched
- ✗ Unintended partial matches included
- ✗ Mentions to other users also included
2. is_or_search: false (Proposed fix)
curl -X POST http://localhost:8065/api/v4/posts/search \
-H "Authorization: Bearer ${TOKEN}" \
-H "Content-Type: application/json" \
-d '{"terms":"@user-testlogin01","is_or_search":false}'
Result: Only 2 posts returned
- ✓ Only exact mentions to
@user-testlogin01 - ✓ No unintended partial matches
- ✓ Clean, relevant results
Conclusion:
- Problem identified:
is_or_search: truecauses false positives with partial matches - Solution: Use
is_or_search: falsefor Recent Mentions to ensure only exact mention matches are returned - Impact: Eliminates false positives and improves search accuracy