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 Otis Gospodnetic <ot...@yahoo.com> on 2009/04/01 18:10:42 UTC

Re: Wildcard searches

Hi,

Another option for 1) is to use n-grams with token begin/end symbols.  Then you won't need to use wildcards at all, but you'll have a larger index.

2) may be added to Lucene in the near future, actually, I saw a related JIRA issue.  But in the mean time, yes, you coul dimplement it via a custom QParserPlugin.

Otis
--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch



----- Original Message ----
> From: "Vauthrin, Laurent" <La...@disney.com>
> To: solr-user@lucene.apache.org
> Sent: Monday, March 30, 2009 5:45:30 PM
> Subject: Wildcard searches
> 
> Hello again,
> 
> I'm in the process of converting one of our services that was previously
> using Lucene to use Solr instead.  The main focus here is to preserve
> backwards compatibility (even if some searches are not as efficient).
> There are currently two scenarios that are giving me problems right now.
> 
> 1. Leading wildcard searches/suffix searches (e.g. *ickey)
> I've looked at https://issues.apache.org/jira/browse/SOLR-218.  Is the
> best approach to create a QParserPlugin and change the parser to allow
> leading wildcards - setAllowLeadingWildcard(true)?  At the moment we're
> trying to avoid indexing terms in reverse order.
> 
> 2. Phrase searches with wildcards (e.g. "Mickey Mou*")
> From what I understand, Solr/Lucene doesn't support this but we used to
> get results with the following code:
>     
>     new WildcardQuery(new Term("U_name", " Mickey Mou*"))
> 
> Is it possible for me to allow this capability in a QParserPlugin?  Is
> there another way for me to do it?
> 
> Thanks,
> Laurent Vauthrin


RE: Wildcard searches

Posted by "Vauthrin, Laurent" <La...@disney.com>.
Looks like I was using the wrong field when searching (tokenized instead
of untokenized) and this approach actually worked.  Sorry for the
confusion.

-----Original Message-----
From: Vauthrin, Laurent 
Sent: Monday, April 06, 2009 10:03 AM
To: solr-user@lucene.apache.org
Subject: RE: Wildcard searches

So I've started making a QParserPlugin to handle phrase wild card
searches but I think I need a little bit of guidance.  In my plugin I've
subclassed the SolrQueryParser and overridden the getFieldQuery(...)
method so that I can handle queries that contain spaces and wildcards.
I naively tried to construct a WildcardQuery object from the query text
but that didn't seem to work.  What sort of Query object(s) should I be
using here?  (Note: the field I'm working with is an untokenized field).

Thanks,
Laurent

-----Original Message-----
From:
solr-user-return-20352-Laurent.Vauthrin=disney.com@lucene.apache.org
[mailto:solr-user-return-20352-Laurent.Vauthrin=disney.com@lucene.apache
.org] On Behalf Of Otis Gospodnetic
Sent: Wednesday, April 01, 2009 9:11 AM
To: solr-user@lucene.apache.org
Subject: Re: Wildcard searches


Hi,

Another option for 1) is to use n-grams with token begin/end symbols.
Then you won't need to use wildcards at all, but you'll have a larger
index.

2) may be added to Lucene in the near future, actually, I saw a related
JIRA issue.  But in the mean time, yes, you coul dimplement it via a
custom QParserPlugin.

Otis
--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch



----- Original Message ----
> From: "Vauthrin, Laurent" <La...@disney.com>
> To: solr-user@lucene.apache.org
> Sent: Monday, March 30, 2009 5:45:30 PM
> Subject: Wildcard searches
> 
> Hello again,
> 
> I'm in the process of converting one of our services that was
previously
> using Lucene to use Solr instead.  The main focus here is to preserve
> backwards compatibility (even if some searches are not as efficient).
> There are currently two scenarios that are giving me problems right
now.
> 
> 1. Leading wildcard searches/suffix searches (e.g. *ickey)
> I've looked at https://issues.apache.org/jira/browse/SOLR-218.  Is the
> best approach to create a QParserPlugin and change the parser to allow
> leading wildcards - setAllowLeadingWildcard(true)?  At the moment
we're
> trying to avoid indexing terms in reverse order.
> 
> 2. Phrase searches with wildcards (e.g. "Mickey Mou*")
> From what I understand, Solr/Lucene doesn't support this but we used
to
> get results with the following code:
>     
>     new WildcardQuery(new Term("U_name", " Mickey Mou*"))
> 
> Is it possible for me to allow this capability in a QParserPlugin?  Is
> there another way for me to do it?
> 
> Thanks,
> Laurent Vauthrin


RE: Wildcard searches

Posted by "Vauthrin, Laurent" <La...@disney.com>.
So I've started making a QParserPlugin to handle phrase wild card
searches but I think I need a little bit of guidance.  In my plugin I've
subclassed the SolrQueryParser and overridden the getFieldQuery(...)
method so that I can handle queries that contain spaces and wildcards.
I naively tried to construct a WildcardQuery object from the query text
but that didn't seem to work.  What sort of Query object(s) should I be
using here?  (Note: the field I'm working with is an untokenized field).

Thanks,
Laurent

-----Original Message-----
From:
solr-user-return-20352-Laurent.Vauthrin=disney.com@lucene.apache.org
[mailto:solr-user-return-20352-Laurent.Vauthrin=disney.com@lucene.apache
.org] On Behalf Of Otis Gospodnetic
Sent: Wednesday, April 01, 2009 9:11 AM
To: solr-user@lucene.apache.org
Subject: Re: Wildcard searches


Hi,

Another option for 1) is to use n-grams with token begin/end symbols.
Then you won't need to use wildcards at all, but you'll have a larger
index.

2) may be added to Lucene in the near future, actually, I saw a related
JIRA issue.  But in the mean time, yes, you coul dimplement it via a
custom QParserPlugin.

Otis
--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch



----- Original Message ----
> From: "Vauthrin, Laurent" <La...@disney.com>
> To: solr-user@lucene.apache.org
> Sent: Monday, March 30, 2009 5:45:30 PM
> Subject: Wildcard searches
> 
> Hello again,
> 
> I'm in the process of converting one of our services that was
previously
> using Lucene to use Solr instead.  The main focus here is to preserve
> backwards compatibility (even if some searches are not as efficient).
> There are currently two scenarios that are giving me problems right
now.
> 
> 1. Leading wildcard searches/suffix searches (e.g. *ickey)
> I've looked at https://issues.apache.org/jira/browse/SOLR-218.  Is the
> best approach to create a QParserPlugin and change the parser to allow
> leading wildcards - setAllowLeadingWildcard(true)?  At the moment
we're
> trying to avoid indexing terms in reverse order.
> 
> 2. Phrase searches with wildcards (e.g. "Mickey Mou*")
> From what I understand, Solr/Lucene doesn't support this but we used
to
> get results with the following code:
>     
>     new WildcardQuery(new Term("U_name", " Mickey Mou*"))
> 
> Is it possible for me to allow this capability in a QParserPlugin?  Is
> there another way for me to do it?
> 
> Thanks,
> Laurent Vauthrin