Files
the-bible/backend/src/searchDatabase.js
Joshua Ryder 246d849163 Enhance: Add exact match boosting to search relevance scoring
FTS5 with Porter stemming treats 'kindness' and 'kind' as the same root word,
which caused stemmed matches to rank equally with exact matches. This adds a
secondary relevance boost on top of BM25 to prioritize exact matches.

Relevance scoring now:
- BM25 base score (from FTS5)
- +100 for exact phrase match in verse text
- +50 per exact word match (e.g., 'kindness' exactly)
- +10 per partial/stemmed match (e.g., 'kind' via stemming)

Example: Searching for 'kindness'
- Verses with 'kindness': BM25 + 150 (phrase + word)
- Verses with 'kind': BM25 + 10 (partial match)

This ensures exact matches appear first while still benefiting from Porter
stemming to find all word variations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-10 20:05:29 -05:00

12 KiB