You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@answer.apache.org by "LinkinStars (via GitHub)" <gi...@apache.org> on 2026/10/15 02:07:03 UTC
Re: [PR] fix: keep tag search filter for hyphenated slugs [answer]
LinkinStars commented on PR #1638:
URL: https://github.com/apache/answer/pull/1638#issuecomment-6182755003
Thanks for identifying and covering the hyphen/dot/plus slug case. There is one parsing conflict that should be addressed before merging.
The new pattern accepts any non-whitespace, non-bracket character inside `[tag]`, including `:`. Tag slugs currently have no backend character validation beyond length, and the UI character restriction is commented out, so slugs such as `score:3` or `user:me` can exist.
However, `ReplaceSearchContent` extracts `key:value` tokens before it extracts `[tag]` tokens. For example, with:
```text
[score:3] database
```
`keyValueRegex` also matches `score:3]` inside the brackets. The reconstructed query therefore contains both a tag token and a score filter token. Later, `parseTags` resolves `[score:3]`, while `parseVotes` also sees `score:3` and applies an unintended score filter. The remaining bracket characters can also end up in the search words.
The same issue applies to `[user:me]`, `[answers:0]`, `[is:question]`, and the other documented advanced-search prefixes.
Could we first extract and remove complete `[tag]` tokens, then run the `key:value` extraction only on the remaining text? Please also add regression tests for at least `[score:3]` and `[user:me]` to verify that a tag slug does not activate the corresponding advanced-search filter. This would preserve the intended fix for `react-native`, `node.js`, and `c++` without making the search syntaxes ambiguous.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@answer.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@answer.apache.org
For additional commands, e-mail: issues-help@answer.apache.org