Can I configure the lucene search engine to support leading wildcards?

Tilmann Brenk July 25, 2011

Jira uses the Lucene search engine and Jira documentation says leading wildcards like *something are not supported. But apparently Lucene could do this, see the the excerpt from the Lucene Wiki

Does anybody know if I could configure Lucene this way in a Jira installation?

----------

What wildcard search support is available from Lucene?

Lucene supports wild card queries which allow you to perform searches such as book*, which will find documents containing terms such as book, bookstore, booklet, etc. Lucene refers to this type of a query as a 'prefix query'.

Lucene also supports wild card queries which allow you to place a wild card in the middle of the query term. For instance, you could make searches like: mi*pelling. That will match both misspelling, which is the correct way to spell this word, as well as mispelling, which is a common spelling mistake.

Another wild card character that you can use is '?', a question mark. The ? will match a single character. This allows you to perform queries such as Bra?il. Such a query will match both Brasil and Brazil. Lucene refers to this type of a query as a 'wildcard query'.

Leading wildcards (e.g. *ook) are not supported by the QueryParser by default. As of Lucene 2.1, they can be enabled by calling <tt class="backtick">QueryParser.setAllowLeadingWildcard( true )</tt>. Note that this can be an expensive operation: it requires scanning the list of tokens in the index in its entirety to look for those that match the pattern.

1 answer

1 accepted

2 votes
Answer accepted
Tilmann Brenk July 28, 2011

There is already a long standing (since 2005) feature request for this feature.

https://jira.atlassian.com/browse/JRA-6218

It could be done rather easily, but it has not got enough votes to be started.

It seems not to be possible to do this by configuration as jira itself prevents entering leading wildcards.

So if anyone else is interested, just cast a vote!

Suggest an answer

Log in or Sign up to answer