Thanks for all the help. The only field where I need this is to search sku fields...example being "19-JN910" The search needs to be able to pull a match if the query were "JN" ...Erik's solution is the way to go and simple to implement.
> From: "Yonik Seeley" <[EMAIL PROTECTED]> > Reply-To: solr-user@lucene.apache.org > Date: Tue, 20 Jun 2006 09:53:53 -0400 > To: solr-user@lucene.apache.org > Subject: Re: Wildcard Query > > 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 >