Updates of fuzziness rules for tokens search#277
Conversation
WalkthroughThis pull request modifies the search logic within the Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant S as searchTokens Function
participant F as Fuse Instance
participant M as Mapping of Results
U->>S: Initiate token search with query
S->>S: Check if query length > 40
alt Query length > 40
S->>S: Format query as exact match (="query")
else
S->>S: Use query as provided
end
S->>F: Execute Fuse search with updated configuration
F-->>S: Return search results
S->>M: Map results to extract item property
M-->>S: Processed results returned
S-->>U: Return final search results
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/services/tokensData.ts (2)
213-217: Search key and threshold adjustmentsThe changes to the Fuse configuration have several impacts:
- Removing 'blockchain' from search keys means users can no longer search by chain names
- Lowering the threshold from (likely) 0.3 to 0.2 makes matching more permissive
- Adding minMatchCharLength ensures more relevant results despite the lower threshold
- Enabling extended search supports the exact matching syntax
Was removing 'blockchain' from searchable keys intentional? This will prevent users from finding tokens by typing chain names like "Ethereum" or "Polygon". If this was intentional (perhaps because UI provides chain filtering separately), please add a comment explaining this decision.
219-221: Comment doesn't match implementationThe comment states "Check if query length is above 20 characters" but the code checks for > 40 characters.
Update the comment to match the implementation:
- // Check if query length is above 20 characters have an exact match + // Check if query length is above 40 characters for an exact match
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/services/tokensData.ts(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: unit-tests
- GitHub Check: Cloudflare Pages
- GitHub Check: build
🔇 Additional comments (1)
src/services/tokensData.ts (1)
219-222: Exact matching for long queries is a good approachUsing exact matching for queries longer than 40 characters is excellent for handling contract addresses, where fuzzy matching could lead to incorrect matches between similar-looking but different addresses.
This approach improves search precision for contract addresses while maintaining fuzzy searching for token names and symbols.
Deploying x with
|
| Latest commit: |
5f6c480
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2ebb9ef7.x-e62.pages.dev |
| Branch Preview URL: | https://feat-pro-3166-search-contrac.x-e62.pages.dev |
Description
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Summary by CodeRabbit