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 gunjan_versata <gu...@gmail.com> on 2009/12/03 10:38:56 UTC

Behavior of filter query

Hi, 

I am working on SOLR 1.4. And am trying to implement the multi select
feature on my site. I dont want the faceting counts but only results. I
tried diff variations in my query :

They are:

http://localhost:8080/solr/select?q=*:*&fq=product_category:Mobiles+%2Bproperty_make:(Nokia%20OR%20Sony-Ericsson)+%2Bproperty_bodyType:(CandyBar%20OR%20Slider)
Result : 47

http://localhost:8080/solr/select?q=Mobiles&qt=store&fq=property_make:(Nokia%20OR%20Sony-Ericsson)&fq=property_bodyType:(CandyBar%20OR%20Slider)
Result : 47

http://localhost:8080/solr/select?q=Mobiles&qt=store&fq=property_make:(Nokia%20OR%20Sony-Ericsson)+%2Bproperty_bodyType:(CandyBar%20OR%20Slider)
Result : 148

Now problem is, on the basis of my knowledge, I expected all three queries
to give out the same results. Then, why is 3rd one behaving differently? By
the way, in the third query, the result set includes entries which have
either of them, ie it is behaving like OR, not AND. 

Also, if anyone could tell me, performance wise which is the best...

For more insight: 

Schema:

<fieldType name="lowercase" class="solr.TextField"
positionIncrementGap="100">
      <analyzer>
        <tokenizer class="solr.KeywordTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory" />
        <filter class="solr.TrimFilterFactory" />
        <filter class="solr.SnowballPorterFilterFactory" language="English"
protected="protwords.txt"/>
      </analyzer>
</fieldType>

<field name="family_id" type="string" indexed="true" stored="true"
omitNorms="true"/>
   <field name="product_category" type="string" indexed="true" stored="true"
omitNorms="true" />
   <field name="img_url" type="string" indexed="false" stored="true" />
   <field name="title" type="text" indexed="true" stored="true" />
   <field name="price"  type="float" stored="true"/>
   <field name="sdp_url" type="string" indexed="false" stored="true" />
   <field name="inStock" type="boolean" indexed="true" stored="false" />
   <field name="property_keywords" type="string" stored="false"
indexed="true" multiValued="true"/>
   <field name="property_features" type="string" stored="true"
indexed="true" multiValued="true"/>
   <dynamicField name="property_*" type="string" stored="true"
indexed="true"/>

<field name="text" type="lowercase" indexed="true" stored="false"
multiValued="true"/>
<copyField source="property_*" dest="text"/>


Handler: 

  <requestHandler name="store" class="solr.SearchHandler" >
    <lst name="defaults">
     <str name="defType">dismax</str>
     <str name="echoParams">explicit</str>
     <str name="qf">
        product_category
     </str>
     <str name="mm">100%</str>
    </lst>
    <lst name="appends">
      <str name="fq">inStock:true</str>
    </lst>
  </requestHandler>

I am looking out for a quick response. Any kind of help would be highly
appreciated. 

Regards,

Gunjan
-- 
View this message in context: http://old.nabble.com/Behavior-of-filter-query-tp26623237p26623237.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Behavior of filter query

Posted by Lance Norskog <go...@gmail.com>.
The second makes 2 large docsets and ands them together against the
query. The third makes the intersection of the two filter queries, The
third will use the least memory and run the fastest.

The first is the slowest because it has to find each docid and check
it against the filter query docset. I think.

On Thu, Dec 3, 2009 at 1:55 AM, gunjan_versata <gu...@gmail.com> wrote:
>
>
> Guess I found the problem.. By using fq=%2B bla blo  seems to be fixing the
> problem... Can anyone tell me why is it necessary?
>
> also, which query is the best amongst all?
>
> -Gunjan
>
>
> gunjan_versata wrote:
>>
>> Hi,
>>
>> I am working on SOLR 1.4. And am trying to implement the multi select
>> feature on my site. I dont want the faceting counts but only results. I
>> tried diff variations in my query :
>>
>> They are:
>>
>> http://localhost:8080/solr/select?q=*:*&fq=product_category:Mobiles+%2Bproperty_make:(Nokia%20OR%20Sony-Ericsson)+%2Bproperty_bodyType:(CandyBar%20OR%20Slider)
>> Result : 47
>>
>> http://localhost:8080/solr/select?q=Mobiles&qt=store&fq=property_make:(Nokia%20OR%20Sony-Ericsson)&fq=property_bodyType:(CandyBar%20OR%20Slider)
>> Result : 47
>>
>> http://localhost:8080/solr/select?q=Mobiles&qt=store&fq=property_make:(Nokia%20OR%20Sony-Ericsson)+%2Bproperty_bodyType:(CandyBar%20OR%20Slider)
>> Result : 148
>>
>> Now problem is, on the basis of my knowledge, I expected all three queries
>> to give out the same results. Then, why is 3rd one behaving differently?
>> By the way, in the third query, the result set includes entries which have
>> either of them, ie it is behaving like OR, not AND.
>>
>> Also, if anyone could tell me, performance wise which is the best...
>>
>> For more insight:
>>
>> Schema:
>>
>> <fieldType name="lowercase" class="solr.TextField"
>> positionIncrementGap="100">
>>       <analyzer>
>>         <tokenizer class="solr.KeywordTokenizerFactory"/>
>>         <filter class="solr.LowerCaseFilterFactory" />
>>         <filter class="solr.TrimFilterFactory" />
>>         <filter class="solr.SnowballPorterFilterFactory"
>> language="English" protected="protwords.txt"/>
>>       </analyzer>
>> </fieldType>
>>
>> <field name="family_id" type="string" indexed="true" stored="true"
>> omitNorms="true"/>
>>    <field name="product_category" type="string" indexed="true"
>> stored="true" omitNorms="true" />
>>    <field name="img_url" type="string" indexed="false" stored="true" />
>>    <field name="title" type="text" indexed="true" stored="true" />
>>    <field name="price"  type="float" stored="true"/>
>>    <field name="sdp_url" type="string" indexed="false" stored="true" />
>>    <field name="inStock" type="boolean" indexed="true" stored="false" />
>>    <field name="property_keywords" type="string" stored="false"
>> indexed="true" multiValued="true"/>
>>    <field name="property_features" type="string" stored="true"
>> indexed="true" multiValued="true"/>
>>    <dynamicField name="property_*" type="string" stored="true"
>> indexed="true"/>
>>
>> <field name="text" type="lowercase" indexed="true" stored="false"
>> multiValued="true"/>
>> <copyField source="property_*" dest="text"/>
>>
>>
>> Handler:
>>
>>   <requestHandler name="store" class="solr.SearchHandler" >
>>     <lst name="defaults">
>>      <str name="defType">dismax</str>
>>      <str name="echoParams">explicit</str>
>>      <str name="qf">
>>         product_category
>>      </str>
>>      <str name="mm">100%</str>
>>     </lst>
>>     <lst name="appends">
>>       <str name="fq">inStock:true</str>
>>     </lst>
>>   </requestHandler>
>>
>> I am looking out for a quick response. Any kind of help would be highly
>> appreciated.
>>
>> Regards,
>>
>> Gunjan
>>
>
> --
> View this message in context: http://old.nabble.com/Behavior-of-filter-query-tp26623237p26623470.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>



-- 
Lance Norskog
goksron@gmail.com

Re: Behavior of filter query

Posted by gunjan_versata <gu...@gmail.com>.

Guess I found the problem.. By using fq=%2B bla blo  seems to be fixing the
problem... Can anyone tell me why is it necessary? 

also, which query is the best amongst all?

-Gunjan


gunjan_versata wrote:
> 
> Hi, 
> 
> I am working on SOLR 1.4. And am trying to implement the multi select
> feature on my site. I dont want the faceting counts but only results. I
> tried diff variations in my query :
> 
> They are:
> 
> http://localhost:8080/solr/select?q=*:*&fq=product_category:Mobiles+%2Bproperty_make:(Nokia%20OR%20Sony-Ericsson)+%2Bproperty_bodyType:(CandyBar%20OR%20Slider)
> Result : 47
> 
> http://localhost:8080/solr/select?q=Mobiles&qt=store&fq=property_make:(Nokia%20OR%20Sony-Ericsson)&fq=property_bodyType:(CandyBar%20OR%20Slider)
> Result : 47
> 
> http://localhost:8080/solr/select?q=Mobiles&qt=store&fq=property_make:(Nokia%20OR%20Sony-Ericsson)+%2Bproperty_bodyType:(CandyBar%20OR%20Slider)
> Result : 148
> 
> Now problem is, on the basis of my knowledge, I expected all three queries
> to give out the same results. Then, why is 3rd one behaving differently?
> By the way, in the third query, the result set includes entries which have
> either of them, ie it is behaving like OR, not AND. 
> 
> Also, if anyone could tell me, performance wise which is the best...
> 
> For more insight: 
> 
> Schema:
> 
> <fieldType name="lowercase" class="solr.TextField"
> positionIncrementGap="100">
>       <analyzer>
>         <tokenizer class="solr.KeywordTokenizerFactory"/>
>         <filter class="solr.LowerCaseFilterFactory" />
>         <filter class="solr.TrimFilterFactory" />
>         <filter class="solr.SnowballPorterFilterFactory"
> language="English" protected="protwords.txt"/>
>       </analyzer>
> </fieldType>
> 
> <field name="family_id" type="string" indexed="true" stored="true"
> omitNorms="true"/>
>    <field name="product_category" type="string" indexed="true"
> stored="true" omitNorms="true" />
>    <field name="img_url" type="string" indexed="false" stored="true" />
>    <field name="title" type="text" indexed="true" stored="true" />
>    <field name="price"  type="float" stored="true"/>
>    <field name="sdp_url" type="string" indexed="false" stored="true" />
>    <field name="inStock" type="boolean" indexed="true" stored="false" />
>    <field name="property_keywords" type="string" stored="false"
> indexed="true" multiValued="true"/>
>    <field name="property_features" type="string" stored="true"
> indexed="true" multiValued="true"/>
>    <dynamicField name="property_*" type="string" stored="true"
> indexed="true"/>
> 
> <field name="text" type="lowercase" indexed="true" stored="false"
> multiValued="true"/>
> <copyField source="property_*" dest="text"/>
> 
> 
> Handler: 
> 
>   <requestHandler name="store" class="solr.SearchHandler" >
>     <lst name="defaults">
>      <str name="defType">dismax</str>
>      <str name="echoParams">explicit</str>
>      <str name="qf">
>         product_category
>      </str>
>      <str name="mm">100%</str>
>     </lst>
>     <lst name="appends">
>       <str name="fq">inStock:true</str>
>     </lst>
>   </requestHandler>
> 
> I am looking out for a quick response. Any kind of help would be highly
> appreciated. 
> 
> Regards,
> 
> Gunjan
> 

-- 
View this message in context: http://old.nabble.com/Behavior-of-filter-query-tp26623237p26623470.html
Sent from the Solr - User mailing list archive at Nabble.com.