Context
The search service in src/services/search.service.ts currently uses simple contains matching and basic ordering. This works for basic lookup, but it does not rank results by relevance or make the ordering feel intuitive for users searching across campaigns and donations.
Problem statement
Implement a lightweight relevance ranking approach for search results so that more relevant campaign and donation matches appear earlier, while still preserving stable pagination and filtering behavior.
Current behavior
- Campaign and donation searches use simple substring matching and sort by a single field such as creation date.
- There is no relevance-based ranking beyond the raw query match.
Required behavior
- Search results should be ordered by a simple relevance score derived from the query and the matched fields.
- The ranking should remain deterministic and compatible with existing pagination.
- The ranking should not make searches slower than the current basic implementation in a meaningful way.
Constraints
- The change should stay within the current Prisma and service architecture.
- No external search engine is required.
Acceptance criteria
Out of scope
- Building a full-text search engine or semantic search system.
- Rewriting the search API schema.
Hints and references
- Review the current
contains-based filters and the existing sort logic in the search service.
Context
The search service in src/services/search.service.ts currently uses simple
containsmatching and basic ordering. This works for basic lookup, but it does not rank results by relevance or make the ordering feel intuitive for users searching across campaigns and donations.Problem statement
Implement a lightweight relevance ranking approach for search results so that more relevant campaign and donation matches appear earlier, while still preserving stable pagination and filtering behavior.
Current behavior
Required behavior
Constraints
Acceptance criteria
Out of scope
Hints and references
contains-based filters and the existing sort logic in the search service.