My plan is to implement search heuristics as separate functions in the
backend, with associated indexes, from easiest to hardest.
- Simple prefix search if the query term looks like a URL
- Exact (full) keyword search: split the query into queryable terms. Try to find a match for all terms. Sort by relevance.
- Exact (partial) keyword search (todo): split the query into queryable terms. Try to find a match for most of the terms. Sort by relevance.
- Fuzzy keyword search (todo): if the keywords didn't match anything, try to find the closest keyword that matches, and search again.
Having all those steps separately will allow the frontend to let the user either
have us try harder to find a match, or to refine their query terms.