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 John Thorhauer <jt...@yakabod.com> on 2010/01/18 22:31:37 UTC

filter query parsing problem

I am submitting a query and it seems to be parsing incorrectly.  Here
is the query with the debug output.  Any ideas what the problem is:

<arr name="filter_queries">
  <str>
    ((VLog:814124 || VLog:12342) && (PublisherType:U || PublisherType:A))
  </str>
</arr>
<arr name="parsed_filter_queries">
    <str>+(VLog:814124 VLog:12342) +PublisherType:u</str>
</arr>

I would have thought that the parsed filter would have looked like this:
        <str>+(VLog:814124 VLog:12342) +(PublisherType:u PublisherType:a)</str>

Thanks for the help,
John Thorhauer

Re: filter query parsing problem

Posted by Erik Hatcher <er...@gmail.com>.
On Jan 20, 2010, at 9:34 AM, Shalin Shekhar Mangar wrote:

> On Wed, Jan 20, 2010 at 7:40 PM, Erik Hatcher  
> <er...@gmail.com>wrote:
>
>>
>> On Jan 20, 2010, at 8:11 AM, Ahmet Arslan wrote:
>>
>> If they are really filter queries i.e. specified through
>>>> "fq" then they will
>>>> not be run through an analyzer.
>>>>
>>>>
>>> Does this mean filter queries are not analyzed? The query below  
>>> returns a
>>> document.
>>>
>>>
>>> http://localhost:8983/solr/select/?q=*%3A*&version=2.2&start=0&rows=10&indent=on&debugQuery=on&fq=features:GOOD
>>>
>>> Am I missing something?
>>>
>>
>> filter queries are query parsed using the  
>> "lucene" (SolrQueryParser) query
>> parser (and appropriate pieces analyzed per field type  
>> configuration).  So
>> the above statement that filter queries are not analyzed is  
>> incorrect.
>>
>>
> Wow! I learned something new today. I guess that using fq for  
> drilling down
> on facets all this time, I somehow came to believe that a filter  
> query is
> not analyzed. Moreover, I've been responsible for misleading quite a  
> few
> people on this forum regarding this topic. Thanks Ahmet for  
> challenging me
> and Erik for the authoritative word :)
>
> /me goes off to fix the wiki

:)

It's most common that fq's are used to drill into facets, which are  
themselves most often indexed as "string" type.  So, an  
fq=category:"Music and Electronics" is not really "analyzed" per se.   
But, in general that is a Lucene query expression.  I actually really  
strongly recommend folks use <fq={!raw f=category}Music and  
Electronics> so that query parsing and analysis and such don't  
interfere when it is really meant to be a straight TermQuery.

	Erik


Re: filter query parsing problem

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Wed, Jan 20, 2010 at 7:40 PM, Erik Hatcher <er...@gmail.com>wrote:

>
> On Jan 20, 2010, at 8:11 AM, Ahmet Arslan wrote:
>
>  If they are really filter queries i.e. specified through
>>> "fq" then they will
>>> not be run through an analyzer.
>>>
>>>
>> Does this mean filter queries are not analyzed? The query below returns a
>> document.
>>
>>
>> http://localhost:8983/solr/select/?q=*%3A*&version=2.2&start=0&rows=10&indent=on&debugQuery=on&fq=features:GOOD
>>
>> Am I missing something?
>>
>
> filter queries are query parsed using the "lucene" (SolrQueryParser) query
> parser (and appropriate pieces analyzed per field type configuration).  So
> the above statement that filter queries are not analyzed is incorrect.
>
>
Wow! I learned something new today. I guess that using fq for drilling down
on facets all this time, I somehow came to believe that a filter query is
not analyzed. Moreover, I've been responsible for misleading quite a few
people on this forum regarding this topic. Thanks Ahmet for challenging me
and Erik for the authoritative word :)

/me goes off to fix the wiki

-- 
Regards,
Shalin Shekhar Mangar.

Re: filter query parsing problem

Posted by Erik Hatcher <er...@gmail.com>.
On Jan 20, 2010, at 8:11 AM, Ahmet Arslan wrote:

>> If they are really filter queries i.e. specified through
>> "fq" then they will
>> not be run through an analyzer.
>>
>
> Does this mean filter queries are not analyzed? The query below  
> returns a document.
>
> http://localhost:8983/solr/select/?q=*%3A*&version=2.2&start=0&rows=10&indent=on&debugQuery=on&fq=features:GOOD
>
> Am I missing something?

filter queries are query parsed using the "lucene" (SolrQueryParser)  
query parser (and appropriate pieces analyzed per field type  
configuration).  So the above statement that filter queries are not  
analyzed is incorrect.

	Erik



Re: filter query parsing problem

Posted by Ahmet Arslan <io...@yahoo.com>.
> If they are really filter queries i.e. specified through
> "fq" then they will
> not be run through an analyzer.
> 

Does this mean filter queries are not analyzed? The query below returns a document.

http://localhost:8983/solr/select/?q=*%3A*&version=2.2&start=0&rows=10&indent=on&debugQuery=on&fq=features:GOOD

Am I missing something?



      

Re: filter query parsing problem

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Tue, Jan 19, 2010 at 3:10 AM, Ahmet Arslan <io...@yahoo.com> wrote:

> > I am submitting a query and it seems
> > to be parsing incorrectly.  Here
> > is the query with the debug output.  Any ideas what
> > the problem is:
> >
> > <arr name="filter_queries">
> >   <str>
> >     ((VLog:814124 || VLog:12342) &&
> > (PublisherType:U || PublisherType:A))
> >   </str>
> > </arr>
> > <arr name="parsed_filter_queries">
> >     <str>+(VLog:814124 VLog:12342)
> > +PublisherType:u</str>
> > </arr>
> >
> > I would have thought that the parsed filter would have
> > looked like this:
> >         <str>+(VLog:814124
> > VLog:12342) +(PublisherType:u PublisherType:a)</str>
>
> It seems that stopfilterfactory is eating A which is a stop word. You can
> remove stopfilterfactory from analyzer chain of type of PublisherType. Or
> you can remove entry a from stopwords.txt.
>
>
If they are really filter queries i.e. specified through "fq" then they will
not be run through an analyzer.

-- 
Regards,
Shalin Shekhar Mangar.

Re: filter query parsing problem

Posted by John Thorhauer <jt...@yakabod.com>.
Ahmet,

Thanks so much for the help.  I will give it a shot.

John

On Mon, Jan 18, 2010 at 4:40 PM, Ahmet Arslan <io...@yahoo.com> wrote:
>> I am submitting a query and it seems
>> to be parsing incorrectly.  Here
>> is the query with the debug output.  Any ideas what
>> the problem is:
>>
>> <arr name="filter_queries">
>>   <str>
>>     ((VLog:814124 || VLog:12342) &&
>> (PublisherType:U || PublisherType:A))
>>   </str>
>> </arr>
>> <arr name="parsed_filter_queries">
>>     <str>+(VLog:814124 VLog:12342)
>> +PublisherType:u</str>
>> </arr>
>>
>> I would have thought that the parsed filter would have
>> looked like this:
>>         <str>+(VLog:814124
>> VLog:12342) +(PublisherType:u PublisherType:a)</str>
>
> It seems that stopfilterfactory is eating A which is a stop word. You can remove stopfilterfactory from analyzer chain of type of PublisherType. Or you can remove entry a from stopwords.txt.
>
>
>
>

Re: filter query parsing problem

Posted by Ahmet Arslan <io...@yahoo.com>.
> I am submitting a query and it seems
> to be parsing incorrectly.  Here
> is the query with the debug output.  Any ideas what
> the problem is:
> 
> <arr name="filter_queries">
>   <str>
>     ((VLog:814124 || VLog:12342) &&
> (PublisherType:U || PublisherType:A))
>   </str>
> </arr>
> <arr name="parsed_filter_queries">
>     <str>+(VLog:814124 VLog:12342)
> +PublisherType:u</str>
> </arr>
> 
> I would have thought that the parsed filter would have
> looked like this:
>         <str>+(VLog:814124
> VLog:12342) +(PublisherType:u PublisherType:a)</str>

It seems that stopfilterfactory is eating A which is a stop word. You can remove stopfilterfactory from analyzer chain of type of PublisherType. Or you can remove entry a from stopwords.txt.