Searching user:<username> returns the wrong posts when the username starts with "me"
維護者通常 6 天內回覆
還沒有人認領這個 Issue。
- #1667 來自 @granbellllc-png —— 已關閉,未合併
評估
研究方向
The issue identifies the search parser’s strings.Contains(q, "user:me") check and says the bug occurs before search plugins run; it does not name the parser file or an existing test. Start by locating that check and the search parser tests, then verify that user:me still means the current user while user:melissa returns only melissa’s posts. The author says they have a fix and plan to open a pull request, so check for that work before starting.
由索引模型根據 Issue 內容生成。
描述
Describe the bug
The search tips say user:username searches by author. For any username that starts with me (melissa, megan, meng, mei, ...) the search is treated as user:me instead. A visitor gets results from every author, a signed-in user gets only their own posts, and the rest of the username (lissa) is searched as a word.
The search parser checks strings.Contains(q, "user:me") before it looks up the username, so user:melissa matches that check. This happens before the search plugin is called, so it affects the built-in search and the search plugins alike.
To Reproduce
- Create two users,
melissaandbob. - As melissa, ask "Which port does the parking service use". As bob, ask "Where is the store service configuration".
- Search
user:bob: one result, bob's question. - Search
user:melissa: no results. - Search
user:melissa servicewhile signed out: two results, melissa's and bob's question.
I ran this against dev at ec5e0e9 (SQLite, installed with the AUTO_INSTALL environment variables), calling GET /answer/api/v1/search?order=newest the way the search box does:
q='user:bob' as anonymous count 1 authors [bob]
q='user:melissa' as anonymous count 0 authors []
q='user:melissa' as admin count 0 authors []
q='user:melissa service' as anonymous count 2 authors [melissa, bob]
q='user:me' as melissa count 1 authors [melissa]
Expected behavior
user:melissa returns melissa's posts, the same way user:bob returns bob's. Only user:me itself should mean the current user.
Screenshots
None, the output above is from the API.
Platform
- Device: Desktop (API calls with curl)
- OS: Linux (Docker, golang:1.25)
- Browser and version: not used
- Version:
devat ec5e0e9; the same check is onmain
I have a fix with a test and will open a pull request for it.
- 主要語言
- Go
- 星號
- 15.7k
- 分支
- 1.4k
- 平均合併
- 9 天 6 小時
- 30 天內合併 PR
- 8
環境準備
- 提供 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 沒有貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
apache/answer 的其他 Issue
-
Hardening: cap the invite_user list size in UpdateQuestionInviteUser to bound notification fan-out可能已有人在做 @TastyHeadphones 於 47 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 6 天內回覆
-
Admin AI settings silently reset the assistant prompt, which cannot be edited in the UI可能已有人在做 @Andy-Sverdlov-LucaNet 於 63 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 84/100
維護者通常 6 天內回覆
-
難度 1/5 1-3 小時 新手友好度 75/100
維護者通常 6 天內回覆
-
Server-rendered <time datetime> and JSON-LD dates ignore the site time zone (server-local wall clock labeled as UTC)可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 3/5 1-2 天 新手友好度 78/100
維護者通常 6 天內回覆
-
enhancement
難度 5/5 一週以上 新手友好度 42/100
維護者通常 6 天內回覆
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 62/100
bazel-contrib/rules_go#4784 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 62/100
POSIdev-community/aictl#40 ·
-
難度 2/5 1-3 小時 新手友好度 74/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 62/100
nebari-dev/nebari-infrastructure-core#774 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 72/100
oracle/terraform-provider-oci#2662 ·