-
Notifications
You must be signed in to change notification settings - Fork 3
Add instant search to posts and categories #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
julianbenegas
commented
Jan 6, 2026
- Create /api/search/posts endpoint with Typesense highlighting
- Add usePostSearch hook for client-side instant search
- Update Composer to support onQueryChange callback
- Create PostSearchResults component with highlighted snippets
- Integrate search in NewPostComposer
- Add categoryId to comments index for filtered search
- Pass categoryId to NewPostComposer on category pages
- Create /api/search/posts endpoint with Typesense highlighting - Add usePostSearch hook for client-side instant search - Update Composer to support onQueryChange callback - Create PostSearchResults component with highlighted snippets - Integrate search in NewPostComposer - Add categoryId to comments index for filtered search - Pass categoryId to NewPostComposer on category pages
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Add postTitle and postNumber to comments index for title search - Search both postTitle and text fields in Typesense - Create RepoPostsWithSearch to replace ActivePosts when searching - Add comment ID anchor for direct hash navigation from search - Simplify search API by using indexed data (no DB joins needed)
- Add repos collection to Typesense with name, postCount, lastActive - Add indexRepo, indexAllRepos, searchRepos functions - Add reindexAll function that rebuilds all collections - Update admin "Reindex All" button to show repos/posts/comments counts - Update repo search API to use Typesense - Update index page SearchResult type for new field names - Remove turbopuffer.ts and turbopuffer-index.ts
| {results.map((result) => { | ||
| const href = result.isRootComment | ||
| ? `/${owner}/${repo}/${result.postNumber}` | ||
| : `/${owner}/${repo}/${result.postNumber}#${result.commentId}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| : `/${owner}/${repo}/${result.postNumber}#${result.commentId}` | |
| : `/${owner}/${repo}/${result.postNumber}#comment-${result.commentId}` |
The anchor link for non-root comments uses an incorrect format (# instead of #comment- ), which will prevent navigation to the correct comment.
View Details
Analysis
Incorrect anchor link format prevents navigation to non-root comments in search results
What fails: PostSearchResults component constructs anchor links with format # for non-root comments, but the comment-thread component creates anchor IDs with format comment- . This mismatch prevents clicking search results from navigating to the correct comment.
How to reproduce:
- Search for text that appears in a non-root comment
- Click the search result link
- The page navigates to the post but the URL anchor does not match any element ID
Result: Browser cannot find the element with ID matching the href anchor, so navigation fails (no scroll to comment, no highlighting)
Expected: Anchor link should use format #comment- to match the anchor ID created in comment-thread.tsx line 78
Fix: Updated post-search-results.tsx line 38 to use correct format #comment- , matching the pattern already correctly used in repo-posts-with-search.tsx line 143
|
interesting... but... i wonder if this is desirable... or if we actually want semantic search using turbopuffer and to search "related questions", vs instant search... |