Add Semantic Search Filter to Entities Visualizer #8788
Draft
yusufkinatas wants to merge 2 commits into
Draft
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
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.
🌟 What is the purpose of this PR?
Adds a semantic search filter to the Entities Visualizer. Users can add a "Semantic search" filter from the "Add filter" menu and type a free-text query; entities are then ranked server-side by embedding similarity to that query, rather than by column sort.
This mirrors the behaviour of the global search bar (same embedding model, same distance threshold), but surfaces it as a dismissable, debounced filter pill that composes with the existing web/type/archived filters.
🔍 What does this change?
data/types.ts): adds asemanticSearch: { added, query }field toEntitiesFilterState, plus ahasActiveSemanticQueryhelper.addedtracks whether the pill is present (it can exist with an empty query as a no-op browse);queryholds the debounced free-text query.data/build-filter.ts): when a semantic query is active, pushes acosineDistanceclause against the entityembeddingpath, using aMAXIMUM_SEMANTIC_DISTANCEof0.7(matchingsearch-bar.tsx). The query string is embedded server-side.header/semantic-search-pill.tsx, new): a dismissable pill styled to match the other filter pills, with an inline borderless input. It owns its instantly-updating input buffer and reports a debounced (300ms) value upward. UsesflushOnUnmountso a final keystroke isn't dropped if the pill unmounts mid-debounce.header/add-filters-menu.tsx): both menu items (Include archived,Semantic search) are now optional and self-gating, so adding one filter never blocks adding the other. The menu only hides once both extra filters are added.header/filter-ribbon.tsx): wires the pill in, factors semantic search into the "filters are default" / clear-filters logic, and conditionally renders the pill.use-entities-visualizer-data.tsx): the graph layer disallows cursors alongside acosineDistancefilter ("Cannot use distance function with cursor"), so the cursor is forced off whenever a semantic query is active to guarantee the request can't 500.entities-visualizer.tsx): wires up add/remove/change handlers (with a guard so a late debounced keystroke can't resurrect a stale query), disables "load more" while searching, and shows a "Ranked by relevance" / "Top 500 by relevance" hint. Extracts the result limit into a namedENTITIES_TABLE_RESULT_LIMITconstant — when searching this is a hard cap (no pagination), so the best matches by relevance are always the ones shown.entities-table.tsx): "has more rows" now also requiresloadMoreRowsto be set, so the load-more affordance disappears while searching.Pre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
This PR:
📜 Does this require a change to the docs?
The changes in this PR:
🕸️ Does this require a change to the Turbo Graph?
The changes in this PR:
🛡 What tests cover this?
❓ How to test this?
📹 Demo
Screenshare.-.2026-05-29.8_40_39.PM.mp4