You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by jaystang <ja...@gmail.com> on 2011/09/23 04:08:24 UTC

Solr wildcard searching

Hey guys,
Very new to solr.  I'm using the data import handler to pull customer data
out of my database and index it.  All works great so far.  Now I'm trying to
query against a specific field and I seem to be struggling with doing a
wildcard search. See below.

I have several indexed documents with a "customer_name" field containing
"John Doe".  I have a UI that contains a listing of this indexed data as
well has a keyword filter field (filter as you type).  So I would like when
the user starts typing "J", "John Doe will return, and "Jo", "John Doe" will
return, "Joh"... etc, etc...

I've tried the following:

Search: customer_name:Joh*
Returns: The correct "John Doe" Record"

Search: customer_name:John Do*
Returns: No results (nothing returns w/ 2 works since I don't have the
string in quotes.)

Search: customer_name:"Joh*"
Returns: No results

Search: customer_name:"John Do*"
Returns: No results

Search: customer_NAME:"John Doe*"
Returns: The correct "John Doe" Record"

I feel like I'm close, only issue is when there are multiple words.

Any advice would be appreciated.

Thanks!

--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-wildcard-searching-tp3360681p3360681.html
Sent from the Solr - User mailing list archive at Nabble.com.

A fieldType for a address street

Posted by Nicolas Martin <nm...@doyousoft.com>.
Hi solR users!

I'd like to make research on my client database, in particular, i need 
to find client by their address (ex : "100 avenue des champs élysée")

Does anyone know a good fieldType to store my addresses to enable me to 
search client by address easily ?


thank you all




On 23/09/2011 11:06, Doug McKenzie wrote:
> Im using EdgeNgrams to do the same thing rather than wild card 
> searches. More info here :
> http://www.lucidimagination.com/blog/2009/09/08/auto-suggest-from-popular-queries-using-edgengrams/ 
>
>
> Make sure your search phrase is enclosed in quotes as well so its 
> treated as a phrase rather than 2 words.
>
> On 23/09/2011 03:08, jaystang wrote:
>> Hey guys,
>> Very new to solr.  I'm using the data import handler to pull customer 
>> data
>> out of my database and index it.  All works great so far.  Now I'm 
>> trying to
>> query against a specific field and I seem to be struggling with doing a
>> wildcard search. See below.
>>
>> I have several indexed documents with a "customer_name" field containing
>> "John Doe".  I have a UI that contains a listing of this indexed data as
>> well has a keyword filter field (filter as you type).  So I would 
>> like when
>> the user starts typing "J", "John Doe will return, and "Jo", "John 
>> Doe" will
>> return, "Joh"... etc, etc...
>>
>> I've tried the following:
>>
>> Search: customer_name:Joh*
>> Returns: The correct "John Doe" Record"
>>
>> Search: customer_name:John Do*
>> Returns: No results (nothing returns w/ 2 works since I don't have the
>> string in quotes.)
>>
>> Search: customer_name:"Joh*"
>> Returns: No results
>>
>> Search: customer_name:"John Do*"
>> Returns: No results
>>
>> Search: customer_NAME:"John Doe*"
>> Returns: The correct "John Doe" Record"
>>
>> I feel like I'm close, only issue is when there are multiple words.
>>
>> Any advice would be appreciated.
>>
>> Thanks!
>>
>> -- 
>> View this message in context: 
>> http://lucene.472066.n3.nabble.com/Solr-wildcard-searching-tp3360681p3360681.html 
>>
>> Sent from the Solr - User mailing list archive at Nabble.com.
> -- 
> Become a Firebox Fan on Facebook: http://facebook.com/firebox
> And Follow us on Twitter: http://twitter.com/firebox
>
> Firebox has been nominated for Retailer of the Year in the 2011 Stuff 
> Awards. Who will win? It's up to you! Visit http://www.stuff.tv/awards 
> and place your vote. We'll do a special dance if it's us.
>
> Firebox HQ is MOVING HOUSE! We're migrating from Streatham Hill to  
> shiny new digs in Shoreditch. As of 3rd October please update your 
> records to:
> Firebox.com, 6.10 The Tea Building, 56 Shoreditch High Street, London, 
> E1 6JJ
>
> Global Head Office: Firebox House, Ardwell Road, London SW2 4RT
> Firebox.com Ltd is registered in England and Wales, company number 
> 3874477
> Registered Company Address: 41 Welbeck Street London W1G 8EA Firebox.com
>
> Any views expressed in this email are those of the individual sender, 
> except where the sender expressly, and with authority, states them to 
> be the views of Firebox.com Ltd.


Re: Solr wildcard searching

Posted by Doug McKenzie <do...@firebox.com>.
Im using EdgeNgrams to do the same thing rather than wild card searches. 
More info here :
http://www.lucidimagination.com/blog/2009/09/08/auto-suggest-from-popular-queries-using-edgengrams/

Make sure your search phrase is enclosed in quotes as well so its 
treated as a phrase rather than 2 words.

On 23/09/2011 03:08, jaystang wrote:
> Hey guys,
> Very new to solr.  I'm using the data import handler to pull customer data
> out of my database and index it.  All works great so far.  Now I'm trying to
> query against a specific field and I seem to be struggling with doing a
> wildcard search. See below.
>
> I have several indexed documents with a "customer_name" field containing
> "John Doe".  I have a UI that contains a listing of this indexed data as
> well has a keyword filter field (filter as you type).  So I would like when
> the user starts typing "J", "John Doe will return, and "Jo", "John Doe" will
> return, "Joh"... etc, etc...
>
> I've tried the following:
>
> Search: customer_name:Joh*
> Returns: The correct "John Doe" Record"
>
> Search: customer_name:John Do*
> Returns: No results (nothing returns w/ 2 works since I don't have the
> string in quotes.)
>
> Search: customer_name:"Joh*"
> Returns: No results
>
> Search: customer_name:"John Do*"
> Returns: No results
>
> Search: customer_NAME:"John Doe*"
> Returns: The correct "John Doe" Record"
>
> I feel like I'm close, only issue is when there are multiple words.
>
> Any advice would be appreciated.
>
> Thanks!
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Solr-wildcard-searching-tp3360681p3360681.html
> Sent from the Solr - User mailing list archive at Nabble.com.
--
Become a Firebox Fan on Facebook: http://facebook.com/firebox
And Follow us on Twitter: http://twitter.com/firebox

Firebox has been nominated for Retailer of the Year in the 2011 Stuff Awards. Who will win? It's up to you! Visit http://www.stuff.tv/awards and place your vote. We'll do a special dance if it's us.

Firebox HQ is MOVING HOUSE! We're migrating from Streatham Hill to  shiny new digs in Shoreditch. As of 3rd October please update your records to:
Firebox.com, 6.10 The Tea Building, 56 Shoreditch High Street, London, E1 6JJ

Global Head Office: Firebox House, Ardwell Road, London SW2 4RT
Firebox.com Ltd is registered in England and Wales, company number 3874477
Registered Company Address: 41 Welbeck Street London W1G 8EA Firebox.com
 
Any views expressed in this email are those of the individual sender, except where the sender expressly, and with authority, states them to be the views of Firebox.com Ltd.

Re: Solr wildcard searching

Posted by Erick Erickson <er...@gmail.com>.
Thanks Ludovic, you're absolutely right, I should have added that.

BTW, there are patches that haven't been committed, see:
https://issues.apache.org/jira/browse/SOLR-1604
and similar.

Best
Erick

On Sat, Sep 24, 2011 at 1:32 PM, lboutros <bo...@gmail.com> wrote:
> And to complete the answer of Erick,
>
> in this search,
>
> customer_name:"Joh*"
>
> * is not considered as a wildcard, it is an exact search.
>
> another thing, (it is not your problem...),
>
> Words with wildcards are not analyzed,
> so, if your analyzer contains a lower case filter,
> in the index, these words are stored in lower case:
>
> John -> john
> Do -> do
>
> so,
>
> customer_name:Do* will not find anything.
>
> Ludovic.
>
> -----
> Jouve
> France.
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Solr-wildcard-searching-tp3360681p3365086.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Solr wildcard searching

Posted by lboutros <bo...@gmail.com>.
And to complete the answer of Erick,

in this search,

customer_name:"Joh*" 

* is not considered as a wildcard, it is an exact search.

another thing, (it is not your problem...),

Words with wildcards are not analyzed, 
so, if your analyzer contains a lower case filter,
in the index, these words are stored in lower case: 

John -> john
Do -> do

so,

customer_name:Do* will not find anything.

Ludovic.

-----
Jouve
France.
--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-wildcard-searching-tp3360681p3365086.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr wildcard searching

Posted by Erick Erickson <er...@gmail.com>.
Really, really, get in the habit of looking at your query with
&debugQuery=on appended, it'll save you a world of pain <G>..

customer_name:John Do*
doesn't do what you think. It parses into
customer_name:John OR default_search_field:Do*

you want something like customer_name:(+John +Do*) or
+customer_name:John +customer_name:Do*

You want to look particularly at the parsedquery part of the return, the
scoring stuff is useful for understanding scoring...

And, watch out for your default operator. In the absence of you setting it
in your schema.xml file, it is OR, and a result (with &debugQuery=on) of
customer_name:John customer_name:Do* translates as though it is a
SHOULD clause...

Best
Erick

On Thu, Sep 22, 2011 at 7:08 PM, jaystang <ja...@gmail.com> wrote:
> Hey guys,
> Very new to solr.  I'm using the data import handler to pull customer data
> out of my database and index it.  All works great so far.  Now I'm trying to
> query against a specific field and I seem to be struggling with doing a
> wildcard search. See below.
>
> I have several indexed documents with a "customer_name" field containing
> "John Doe".  I have a UI that contains a listing of this indexed data as
> well has a keyword filter field (filter as you type).  So I would like when
> the user starts typing "J", "John Doe will return, and "Jo", "John Doe" will
> return, "Joh"... etc, etc...
>
> I've tried the following:
>
> Search: customer_name:Joh*
> Returns: The correct "John Doe" Record"
>
> Search: customer_name:John Do*
> Returns: No results (nothing returns w/ 2 works since I don't have the
> string in quotes.)
>
> Search: customer_name:"Joh*"
> Returns: No results
>
> Search: customer_name:"John Do*"
> Returns: No results
>
> Search: customer_NAME:"John Doe*"
> Returns: The correct "John Doe" Record"
>
> I feel like I'm close, only issue is when there are multiple words.
>
> Any advice would be appreciated.
>
> Thanks!
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Solr-wildcard-searching-tp3360681p3360681.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>