feat(search): allow collaborators to find posts by response text#1527
Open
lol2x wants to merge 3 commits into
Open
feat(search): allow collaborators to find posts by response text#1527lol2x wants to merge 3 commits into
lol2x wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extend the post search so collaborators and administrators can match against
posts.responsetext (the staff note set when changing a post's status).This makes it possible to find posts by what was written when closing them —
e.g. retrieving every post marked "Shipped in v2.3.1". For visitors and
anonymous users the SQL and behaviour are unchanged.
How it works
tsvectorcolumnposts.search_response(response only,GIN-indexed). NULL when the post has no response, so the index stays small.
searchPostsextends the predicate and ranking withq.search_response @@ ...only whenuser.IsCollaborator()is true.findSimilarPostsis unchanged.Notes
Response search uses
websearch_to_tsquerywith the raw query soversion-style tokens like
v2.3.1are preserved as a single token. Theexisting title/description path still uses the prefix-matching
to_tsqueryflow.
No frontend changes — the search box automatically benefits from the wider
scope when used by a logged-in collaborator/administrator.