Skip to content

[Feature] Implement High-Performance Search Engine with Natural Language Query Parsing #634

@SatyamPandey-07

Description

@SatyamPandey-07

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):

  1. Smart Query Parser (utils/queryParser.js): Implement a lexer/parser to interpret queries like category:food >500 date:last-month.
  2. 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).
  3. Caching Layer: Integrate a caching strategy (Redis-mock or in-memory LRU) for frequent search results.
  4. Indexing Strategy: Update models/Transaction.js to support text indexes and compound indexes for performance.
  5. API Endpoint: New GET /api/search/smart endpoint 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.

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions