tantivy icon indicating copy to clipboard operation
tantivy copied to clipboard

Is it possible to search with prefixes?

Open sanfilippopablo opened this issue 3 years ago • 2 comments

Hello! First of all, great project. It works really well. However, I have a use case in which I need to search phrases with the last word partially spelled out. For example, I want "search with pref" to match "Is it possible to search with prefixes". I tried using a BooleanQuery to combine a PhraseQuery on the first n-1 terms and a RegexQuery(".*{}.*") on the last term (with OR). But that doesn't enforce that the regex term is right after the phrase result terms. I was hoping scoring to do something with that, but the results have all a score of 2. Any ideas? Thanks!

sanfilippopablo avatar Nov 20 '22 13:11 sanfilippopablo

There's nothing off the shelf, but in general it should be feasible. If you want to implement it, I would start from phrase_query.

PSeitz avatar Nov 20 '22 14:11 PSeitz

this seems to be supported by now, right?

flow3d avatar Oct 01 '25 10:10 flow3d