0

Trying to do a pretty basic search implementation of partial matching. For instance, I'd like 'ia hu' to return 'Ian Hunter'. I've got first and last name split so we're indexing first, last and combined.

Was reading the suggestion in here, but this just isn't a very elegant or feasible way to solve: https://www.algolia.com/doc/faq/troubleshooting/how-can-i-make-queries-within-the-middle-of-a-word.

I don't think we should have to generate a ton of substring combos for first and last name to get this to return results.

Has anyone implemented a more elegant solution?

ian
  • 89
  • 1
  • 4

1 Answers1

1

In this specific use case (matching "Ian Hunter" with "ia hu"), you can turn prefix matching on all words with queryType=prefixAll (see documentation).

This will not allow infix matching, so "an hu" or "ia un" will not match "Ian Hunter". This cannot therefore be considered a general solution to your question. However, in practice, prefix matching tends to be what people use instinctively; infix matching is relatively rare in my experience.