feat(search): smarter ranking, hex disambiguation, numeric dedup#1662
Draft
gregnazario wants to merge 3 commits into
Draft
feat(search): smarter ranking, hex disambiguation, numeric dedup#1662gregnazario wants to merge 3 commits into
gregnazario wants to merge 3 commits into
Conversation
Co-authored-by: Greg Nazario <greg@gnazar.io>
✅ Deploy Preview for aptos-explorer ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Bundle ReportChanges will increase total bundle size by 4.82kB (0.05%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: aptos-explorer-server-esmAssets Changed:
Files in
Files in
Files in
view changes for bundle: aptos-explorer-client-esmAssets Changed:
Files in
Files in
Files in
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1662 +/- ##
==========================================
+ Coverage 32.04% 32.69% +0.65%
==========================================
Files 188 188
Lines 8666 8716 +50
Branches 3251 3269 +18
==========================================
+ Hits 2777 2850 +73
+ Misses 5885 5862 -23
Partials 4 4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-authored-by: Greg Nazario <greg@gnazar.io>
Co-authored-by: Greg Nazario <greg@gnazar.io>
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.

Description
Several related improvements that make explorer search smarter and more intent-aware. Matching/filtering thresholds are unchanged throughout — only result ordering / de-duplication improves. No new dependencies, no network behavior changes.
1. Relevance ranking for assets and known addresses
Coin / fungible-asset results and known-address label results are now ordered by how well they match the query rather than purely by the static Panora popularity index (
coinOrderIndex).A new pure relevance scorer in
app/pages/layout/Search/searchUtils.ts:scoreTextMatch(query, candidate)— exact (100) > prefix (75) > word-boundary prefix (50) > substring (25) > none (0).scoreCoinRelevance(query, coin)— exact asset address paste is the strongest signal (1000); otherwise the best text match acrosssymbol,panoraSymbol, andname, with symbol matches edging out equally-tiered name matches.scoreLabelRelevance(query, label)— relevance for known-address names.handleCoinLookup/handleLabelLookupsort by relevance first, keepingcoinOrderIndexonly as a tie-breaker. SoUSDCsurfaces the coin whose symbol isUSDCfirst even when a more "popular" coin merely containsUSDCas a substring.2. Ambiguous 64-char hex disambiguation
A fully-expanded 64-character hex is ambiguous — transaction hash (
/txn/…) vs 32-byte address.groupSearchResultsnow accepts aprioritizeTransactionsoption; both the header autocomplete (Index.tsx, including its cache path) and the home / full-page search (SearchWithResults.tsx) pass it foris32Hexqueries, so a confirmed transaction is surfaced first and wins the Enter-key /?search=auto-navigate. Non-hex queries keep the existing order.3. Numeric (block height vs transaction version) de-duplication
A bare number is searched three ways: block by height (
/block/N), transaction by version (/txn/N), and the block containing versionN(/block/{containing height}). All three destinations were already correct — the block route only accepts a height, which is exactly why version→height resolution exists. But near genesis a block's height can equal the version it contains, so the height lookup and the containing-block lookup resolved to the same/block/…, rendering two near-identical "Block" rows. A new purebuildNumericSearchResultshelper drops the containing-block entry when it points to the same block as the height lookup.Related Links
FEAT-SEARCH-002/FEAT-SEARCH-003indocs/FEATURES_SPECIFICATION.mdupdated for all three changes.Checklist
pnpm fmt— cleanpnpm lint(tsc + Biome) — cleanpnpm test --run app/pages/layout/Search/ app/pages/Search/— 78 passed (5 files): newsearchRanking.test.ts, plus newprioritizeTransactionsandbuildNumericSearchResultscases insearchFiltering.test.tsCHANGELOG.mdupdated under[Unreleased]docs/FEATURES_SPECIFICATION.mdupdated (FEAT-SEARCH-002/FEAT-SEARCH-003+ Appendix B coverage)