I've investigated this recently, and it looks like the latest lucene dev supposedly supports leading/trailing at the same time. However, I couldn't get the latest dev solr to build with the latest dev lucene (as of two weeks ago). A lucene mailing list seemed to indicate that lucene as of the last official build support both leading/trailing at the same time, but it then seemed to indicate that it was a 'in development branch only' state still. I can't find that thread, but that's my understanding of the current situation. It's bugged us a little bit, because it's something that we need (to be able to emulate the previous foo LIKE '%bar%' SQL behaviour we're replacing), but can't offer our users yet.
On 4/19/07, Burkamp, Christian <[EMAIL PROTECTED]> wrote:
Hi there, Solr does not support leading wildcards, because it uses Lucene's standard QueryParser class without changing the defaults. You can easily change this by inserting the line parser.setAllowLeadingWildcards(true); in QueryParsing.java line 92. (This is after creating a QueryParser instance in QueryParsing.parseQuery(...)) and it obviously means that you have to change solr's source code. It would be nice to have an option in the schema to switch leading wildcards on or off per field. Leading wildcards really make no sense on richly populated fields because queries tend to result in too many clauses exceptions most of the time. This works for leading wildcards. Unfortunately it does not enable searches with leading AND trailing wildcards. (E.g. searching for "*lega*" does not find results even if the term "elegance" is in the index. If you put a second asterisk at the end, the term "elegance" is found. (search for "*lega**" to get hits). Can anybody explain this though it seems to be more of a lucene QueryParser issue? -- Christian -----Ursprüngliche Nachricht----- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 19. April 2007 08:35 An: solr-user@lucene.apache.org Betreff: Leading wildcards hi, we have been trying to get the leading wildcards to work. we have been looking around the Solr website, the Lucene website, wiki's and the mailing lists etc ... but we found a lot of contradictory information. so we have a few question : - is the latest version of lucene capable of handling leading wildcards ? - is the latest version of solr capable of handling leading wildcards ? - do we need to make adjustments to the solr source code ? - if we need to adjust the solr source, what do we need to change ? thanks in advance ! Maarten
-- Michael Kimsal http://webdevradio.com