On 6/20/06, Pace Davis <[EMAIL PROTECTED]> wrote:
I have been using Lucene for about a month now and trying to port the same functionality to Solr. How do I do a wildcard query with a leading "*" ...This is possible with Lucene if you do not use the standard query parser.
It's not really possible to do efficiently with Lucene out-of-the-box either. Terms are sorted, so foo* is a relatively quick query, but *foo is horribly slow since all terms must be scanned. You can do things like what Erik suggests... index all the variants: "Hello" "ello" "llo", etc Another more limited form that would take up less index space would be to index the reverse of the token as well: Index="olleH", query="olle*" We don't yet have an analyzer to do this (and neither does Lucene AFAIK). As Chris points out, in addition to analysis components, the QueryParse would need to be changed as well. I've thought about hooking in the QueryParser to the FieldTypes more before... One reason is to know if something like a prefix query should be lowercased or not. Another reason could be to handle special construction of wildcard queries when there is support for "*foo". -Yonik