Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I do not believe Lucene supports anything like this, nor do I believe it has a trivial solution. </p> <p>"Fuzzy" searches do not operate on a fixed number of characters. <code>bla~</code> may for example match <code>blah</code> and so it must consider the entire term.</p> <p>What you could do is implement a query expansion algorithm that took the query <code>bla~*</code> and converted it into a series of OR queries</p> <pre><code>bla* OR blb* OR blc OR .... etc. </code></pre> <p>But that is really only viable if the string is very short or if you can narrow the expansion based on some rules.</p> <p>Alternatively if the length of the prefix is fixed you could add a field with the substrings and perform the fuzzy search on that. That would give you what you want, but will only work if your use case is sufficiently narrow.</p> <p>You don't specify exactly why you need this, perhaps doing so will elicit other solutions.</p> <p>One scenario I can think of is dealing with different form of words. E.g. finding <code>car</code> and <code>cars</code>.</p> <p>This is easy in English as there are word stemmers available. In other languages it can be quite difficult to implement word stemmers, if not impossible.</p> <p>In this scenario you can however (assuming you have access to a good dictionary) look up the search term and expand the search programmatically to search for all forms of the word.</p> <p>E.g. a search for <code>cars</code> is translated into <code>car OR cars</code>. This has been applied successfully for my language in at least one search engine, but is obviously non-trivial to implement.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload