-
Notifications
You must be signed in to change notification settings - Fork 64
Description
Is your feature request related to a problem? Please describe.
Currently, searching for transactions is limited to basic keyword matching or simple filters. As the dataset grows, finding specific expenses (e.g., "all food transactions over $50 last month") becomes difficult and slow using standard database queries.
Describe the solution you'd like
I propose implementing a dedicated SearchService that provides a powerful full-text search engine with smart query parsing capabilities. This will allow users to search using natural language or complex operators.
Key Technical Requirements (L3 Complexity):
- Smart Query Parser (
utils/queryParser.js): Implement a lexer/parser to interpret queries likecategory:food >500 date:last-month. - Search Service (
services/searchService.js):- Build an optimized aggregation pipeline for complex multi-condition filtering.
- Implement "Fuzzy Matching" using Trigram algorithms for merchant names (handling typos).
- Caching Layer: Integrate a caching strategy (Redis-mock or in-memory LRU) for frequent search results.
- Indexing Strategy: Update models/Transaction.js to support text indexes and compound indexes for performance.
- API Endpoint: New
GET /api/search/smartendpoint handling pagination and facets.
Files to be created/modified:
services/searchService.js(New)utils/queryParser.js(New)routes/search.js(New)- models/Transaction.js (Update indexes)
middleware/cache.js(New)config/search.js(Configuration)
Impact
This will significantly improve user experience for power users and reduce database load by optimizing complex queries.