fix: rank tables first and tighten search in the quick navigator - #703
Open
debba wants to merge 1 commit into
Open
fix: rank tables first and tighten search in the quick navigator#703debba wants to merge 1 commit into
debba wants to merge 1 commit into
Conversation
On a Postgres database with extensions like PostGIS the navigator lists well over a thousand functions next to a few hundred tables. Three things made that painful: - tables, views, routines and triggers had the same weight, so functions sat between the tables you were looking for - the fuzzy threshold (0.4) allowed two edits on a five letter query, which kept most of those functions in the result list - every match was rendered on each keystroke, with no upper bound Tables now get a relevance boost over views, and both over routines and triggers. The boost is small enough that typing the exact name of a function still puts it first. The Fuse threshold drops to 0.3, which still tolerates one typo per four characters. The list renders at most 100 rows while the footer keeps the full match count.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (6 files)
NotesReviewed all six changed files (full files read for context, scope limited to changed lines). The changes cleanly address the quick navigator ranking/performance problem described in the PR:
No security, runtime-error, logic, or edge-case issues found in the changed lines. Reviewed by glm-5.2 · Input: 37.2K · Output: 16K · Cached: 358.5K |
Collaborator
Author
|
thanks for feedback and let me check them in next days |
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.


Problem
A user reported that the quick navigator on their Postgres database shows about 1.6k entries for a schema with roughly 300 tables, that typing a table name does not filter the functions away, and that the search lags.
The extra entries come from extension functions (PostGIS alone adds over a thousand to
public). Three things in the palette made that hard to live with:usersreturned 218 matches, 217 of them functions.Changes
objectPaletteItems.ts: each object gets arelevancefromOBJECT_TYPE_RELEVANCE(table 20, view 10, routine and trigger 0). With an empty query tables come first. With a query, a table containing the text ranks above functions, but typing the exact name of a function still puts that function first, since the boost stays well below the score of a verbatim match.paletteItems.ts: threshold lowered from 0.4 to 0.3. That still tolerates one typo every four characters (the existingpreferensestest keeps passing). AddsMAX_VISIBLE_PALETTE_RESULTS.Palette.tsx: renders at most 100 rows. The footer still shows the total match count so nothing looks missing.The threshold change also applies to the command palette, since both share
createPaletteSearch.Tests
New cases cover the type ranking, the tighter threshold against a large set of function names, exact routine match beating a typo'd table, tables-first ordering on an empty query, and the render cap. Full suite passes (236 files, 3906 tests), plus
pnpm typecheckand eslint on the touched files.Not in this PR
pg_depend). It would shrink the sidebar as well, so it deserves its own discussion.