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 Andrew McCombe <eu...@gmail.com> on 2009/04/30 15:36:54 UTC

Filter query with wildcard, fq=a*

Hi

I have half a million records indexed and need to filter results on a term
by the first letter.  For Example the search term is 'I love' and returns a
few thousand records.  I need to filter these results for all artists
beginning with 'A'.

I've tried:
'fq=artistText:A*'

But then get no results.

Can someone point me in the right direction please?

Regards
Andrew

Re: Filter query with wildcard, fq=a*

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Hi,

Yeah, most of the time that is the case because people tend to lower-case when indexing in order to get case-insensitive searches.  Technically, wildcard queries could match even when they are upper-case - if the input was not lower-cased at index time.

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



----- Original Message ----
> From: Andrew McCombe <eu...@gmail.com>
> To: solr-user@lucene.apache.org
> Sent: Thursday, April 30, 2009 10:04:17 AM
> Subject: Re: Filter query with wildcard, fq=a*
> 
> Hi
> 
> I've sorted it.  Wildcard term must be lowercase to get results.
> 
> Thanks
> Andrew
> 
> 2009/4/30 Andrew McCombe 
> 
> > Hi
> >
> > I have half a million records indexed and need to filter results on a term
> > by the first letter.  For Example the search term is 'I love' and returns a
> > few thousand records.  I need to filter these results for all artists
> > beginning with 'A'.
> >
> > I've tried:
> > 'fq=artistText:A*'
> >
> > But then get no results.
> >
> > Can someone point me in the right direction please?
> >
> > Regards
> > Andrew
> >


Re: Filter query with wildcard, fq=a*

Posted by Rob Casson <ro...@gmail.com>.
it sounds to me like the field you're using (artistText) is tokenized
and lowercased.  it might be good to go over  the wiki pages again:

     http://wiki.apache.org/solr/SolrFacetingOverview

if you keep having problems, post your schema...cheers,
rob

On Thu, Apr 30, 2009 at 10:21 AM, Andrew McCombe <eu...@gmail.com> wrote:
> Hi
>
> It has now introduced a new issue.  I am now getting results for my
> query but they are not what I wanted.  I'm using a Dismax handler and
> am trying to filter a result set with a filter query:
>
> http://localhost:8180/solr/select?indent=on&version=2.2&q=i+love&start=0&rows=30&fl=*%2Cscore&qt=dismax&wt=standard&fq=artistText:e*
>
> This is bringing results with 'e' or 'E' as the first letter and with
> 'e' or 'E' as the first letter after whitespace.  e.g, Eric Prydz,
> Marc Et Claude.
>
> Looking at the solr wiki it seems that I am using the fq param to
> boost the results and not filter them.  Is there a way to achieve the
> required result, i.e, filtering the result set for all artistText
> beginning with 'E'?
>
> Regards
> Andrew
>
>
>
> 2009/4/30 Andrew McCombe <eu...@gmail.com>
>>
>> Hi
>>
>> I've sorted it.  Wildcard term must be lowercase to get results.
>>
>> Thanks
>> Andrew
>>
>> 2009/4/30 Andrew McCombe <eu...@gmail.com>
>>>
>>> Hi
>>>
>>> I have half a million records indexed and need to filter results on a term by the first letter.  For Example the search term is 'I love' and returns a few thousand records.  I need to filter these results for all artists beginning with 'A'.
>>>
>>> I've tried:
>>> 'fq=artistText:A*'
>>>
>>> But then get no results.
>>>
>>> Can someone point me in the right direction please?
>>>
>>> Regards
>>> Andrew
>>
>

Re: Filter query with wildcard, fq=a*

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Hi Andrew,

Is this "starts with letter _" query going to be common in your system?  If so, may I suggest you add another field that stored just the initial letter and stick that in fq?  That will get rid of a single-char prefix wildcard query, which is *expensive*! (read: slow!)

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



----- Original Message ----
> From: Andrew McCombe <eu...@gmail.com>
> To: solr-user@lucene.apache.org
> Sent: Thursday, April 30, 2009 10:21:48 AM
> Subject: Re: Filter query with wildcard, fq=a*
> 
> Hi
> 
> It has now introduced a new issue.  I am now getting results for my
> query but they are not what I wanted.  I'm using a Dismax handler and
> am trying to filter a result set with a filter query:
> 
> http://localhost:8180/solr/select?indent=on&version=2.2&q=i+love&start=0&rows=30&fl=*%2Cscore&qt=dismax&wt=standard&fq=artistText:e*
> 
> This is bringing results with 'e' or 'E' as the first letter and with
> 'e' or 'E' as the first letter after whitespace.  e.g, Eric Prydz,
> Marc Et Claude.
> 
> Looking at the solr wiki it seems that I am using the fq param to
> boost the results and not filter them.  Is there a way to achieve the
> required result, i.e, filtering the result set for all artistText
> beginning with 'E'?
> 
> Regards
> Andrew
> 
> 
> 
> 2009/4/30 Andrew McCombe 
> >
> > Hi
> >
> > I've sorted it.  Wildcard term must be lowercase to get results.
> >
> > Thanks
> > Andrew
> >
> > 2009/4/30 Andrew McCombe 
> >>
> >> Hi
> >>
> >> I have half a million records indexed and need to filter results on a term by 
> the first letter.  For Example the search term is 'I love' and returns a few 
> thousand records.  I need to filter these results for all artists beginning with 
> 'A'.
> >>
> >> I've tried:
> >> 'fq=artistText:A*'
> >>
> >> But then get no results.
> >>
> >> Can someone point me in the right direction please?
> >>
> >> Regards
> >> Andrew
> >


Re: Filter query with wildcard, fq=a*

Posted by Andrew McCombe <eu...@gmail.com>.
Hi

It has now introduced a new issue.  I am now getting results for my
query but they are not what I wanted.  I'm using a Dismax handler and
am trying to filter a result set with a filter query:

http://localhost:8180/solr/select?indent=on&version=2.2&q=i+love&start=0&rows=30&fl=*%2Cscore&qt=dismax&wt=standard&fq=artistText:e*

This is bringing results with 'e' or 'E' as the first letter and with
'e' or 'E' as the first letter after whitespace.  e.g, Eric Prydz,
Marc Et Claude.

Looking at the solr wiki it seems that I am using the fq param to
boost the results and not filter them.  Is there a way to achieve the
required result, i.e, filtering the result set for all artistText
beginning with 'E'?

Regards
Andrew



2009/4/30 Andrew McCombe <eu...@gmail.com>
>
> Hi
>
> I've sorted it.  Wildcard term must be lowercase to get results.
>
> Thanks
> Andrew
>
> 2009/4/30 Andrew McCombe <eu...@gmail.com>
>>
>> Hi
>>
>> I have half a million records indexed and need to filter results on a term by the first letter.  For Example the search term is 'I love' and returns a few thousand records.  I need to filter these results for all artists beginning with 'A'.
>>
>> I've tried:
>> 'fq=artistText:A*'
>>
>> But then get no results.
>>
>> Can someone point me in the right direction please?
>>
>> Regards
>> Andrew
>

Re: Filter query with wildcard, fq=a*

Posted by Andrew McCombe <eu...@gmail.com>.
Hi

I've sorted it.  Wildcard term must be lowercase to get results.

Thanks
Andrew

2009/4/30 Andrew McCombe <eu...@gmail.com>

> Hi
>
> I have half a million records indexed and need to filter results on a term
> by the first letter.  For Example the search term is 'I love' and returns a
> few thousand records.  I need to filter these results for all artists
> beginning with 'A'.
>
> I've tried:
> 'fq=artistText:A*'
>
> But then get no results.
>
> Can someone point me in the right direction please?
>
> Regards
> Andrew
>