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 Jerry Mindek <jm...@manta.com> on 2011/03/10 17:33:45 UTC
question regarding proper placement of geofilt in fq=
Hi,
I am using rev 1036236 of solr trunk running as a servlet in Tomcat 7.
The doc set is sharded over 11 shards.
Currently, I have all the shards running in a single tomcat.
Please see the bottom of the email for the bits of my schema.xml and solrconfig.xml that might help you understand my configuration.
I am seeing what I think is strange behavior when I try to use the geofilt in a filter query.
Here's what I am seeing:
1. If put the {!geofilt} as the last argument of the fq= parameter and I send the following distributed query to my sharded index:
/select?&start=0&rows=30&q=food&fq=b_type:shops AND {!geofilt}&qt=spatialdismax&fl=*%2Cscore&facet=false&pt=38.029191,-78.479266&sfield=lat_long&d=80&shards=...
I get a syntax error. Which seems odd to me.
2. If I move the {!geofilt} to the first position in the fq= and send the following distributed query:
/select?&start=0&rows=30&q=food&fq={!geofilt} AND b_type:T01&qt=spatialdismax&fl=*%2Cscore&facet=false&pt=38.029191,-78.479266&sfield=lat_long&d=80&shards=...
Then only the geofilt is apply, not the b_type:T01. Which seems odd to me. I would expect both filters to be applied.
3. Finally, when I submit this query as:
/select?&start=0&rows=30&q=food&fq=_query_:"{!geofilt} AND b_type:T01&qt=spatialdismax&fl=*%2Cscore&facet=false&pt=38.029191,-78.479266&sfield=lat_long&d=80&shards=...
This works as I had hoped, i.e. both the geofilt and the b_type filters are applied.
Am I trying to use geofilt in the wrong way or is this possibly a bug?
Thanks,
Jerry Mindek
<!--schema.xml-->
<field name="cn" type="text" indexed="true" stored="true" required="true" />
<field name="dn" type="string" indexed="true" stored="true" required="false" />
<field name="t1" type="text" indexed="true" stored="true" />
<field name="ts" type="string" indexed="true" stored="true"/>
<field name="lb" type="text" indexed="true" stored="false" />
<field name="sim" type="string" indexed="true" stored="true" />
<field name="s4_s" type="text" indexed="true" stored="false" />
<field name="stat" type="string" indexed="true" stored="true" />
<field name="pst" type="text" indexed="true" stored="true" />
<fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
...
<field name="type" b_type="string" indexed="true" stored="true"/>
<field name="lat_long" type="location" indexed="true" stored="true" />
<!-end snippet schema.xml-->
<!-solrconfig.xml -->
<requestHandler name="spatialdismax" class="solr.DisMaxRequestHandler" >
<lst name="defaults">
<str name="sort">score desc</str>
<str name="facet">true</str>
<str name="facet.mincount">1</str>
<str name="echoParams">explicit</str>
<int name="rows">20</int>
<float name="tie">0.01</float>
<str name="qf">
cn^2.0 t1^2.0 ts^2.0 lb^2.0 s4_s^2.0 sim^2.0
</str>
<str name="pf">
cn^2.0 t1^2.0 ts^2.0 lb^2.0 s4_s^2.0 sim^2.0
</str>
<str name="fl">dn, cn, t1, stat, pst, pct, ts, sv, score</str>
<str name="mm">
2<-1 5<-2 6<90%
</str>
<int name="ps">100</int>
<str name="q.alt">*:*</str>
</lst>
</requestHandler>
<!-end snippet solrconfig.xml-->
Re: question regarding proper placement of geofilt in fq=
Posted by Bill Bell <bi...@gmail.com>.
Can you use 2 fq parameters ? The default op is usually set to AND.
Bill Bell
Sent from mobile
On Mar 10, 2011, at 9:33 AM, Jerry Mindek <jm...@manta.com> wrote:
> Hi,
>
> I am using rev 1036236 of solr trunk running as a servlet in Tomcat 7.
> The doc set is sharded over 11 shards.
> Currently, I have all the shards running in a single tomcat.
>
> Please see the bottom of the email for the bits of my schema.xml and solrconfig.xml that might help you understand my configuration.
>
> I am seeing what I think is strange behavior when I try to use the geofilt in a filter query.
> Here's what I am seeing:
>
>
> 1. If put the {!geofilt} as the last argument of the fq= parameter and I send the following distributed query to my sharded index:
> /select?&start=0&rows=30&q=food&fq=b_type:shops AND {!geofilt}&qt=spatialdismax&fl=*%2Cscore&facet=false&pt=38.029191,-78.479266&sfield=lat_long&d=80&shards=...
> I get a syntax error. Which seems odd to me.
>
>
> 2. If I move the {!geofilt} to the first position in the fq= and send the following distributed query:
> /select?&start=0&rows=30&q=food&fq={!geofilt} AND b_type:T01&qt=spatialdismax&fl=*%2Cscore&facet=false&pt=38.029191,-78.479266&sfield=lat_long&d=80&shards=...
> Then only the geofilt is apply, not the b_type:T01. Which seems odd to me. I would expect both filters to be applied.
>
>
> 3. Finally, when I submit this query as:
> /select?&start=0&rows=30&q=food&fq=_query_:"{!geofilt} AND b_type:T01&qt=spatialdismax&fl=*%2Cscore&facet=false&pt=38.029191,-78.479266&sfield=lat_long&d=80&shards=...
> This works as I had hoped, i.e. both the geofilt and the b_type filters are applied.
>
> Am I trying to use geofilt in the wrong way or is this possibly a bug?
>
> Thanks,
> Jerry Mindek
>
>
> <!--schema.xml-->
> <field name="cn" type="text" indexed="true" stored="true" required="true" />
> <field name="dn" type="string" indexed="true" stored="true" required="false" />
> <field name="t1" type="text" indexed="true" stored="true" />
> <field name="ts" type="string" indexed="true" stored="true"/>
> <field name="lb" type="text" indexed="true" stored="false" />
> <field name="sim" type="string" indexed="true" stored="true" />
> <field name="s4_s" type="text" indexed="true" stored="false" />
> <field name="stat" type="string" indexed="true" stored="true" />
> <field name="pst" type="text" indexed="true" stored="true" />
> <fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
> ...
> <field name="type" b_type="string" indexed="true" stored="true"/>
> <field name="lat_long" type="location" indexed="true" stored="true" />
> <!-end snippet schema.xml-->
>
> <!-solrconfig.xml -->
> <requestHandler name="spatialdismax" class="solr.DisMaxRequestHandler" >
> <lst name="defaults">
> <str name="sort">score desc</str>
> <str name="facet">true</str>
> <str name="facet.mincount">1</str>
> <str name="echoParams">explicit</str>
> <int name="rows">20</int>
> <float name="tie">0.01</float>
> <str name="qf">
> cn^2.0 t1^2.0 ts^2.0 lb^2.0 s4_s^2.0 sim^2.0
> </str>
> <str name="pf">
> cn^2.0 t1^2.0 ts^2.0 lb^2.0 s4_s^2.0 sim^2.0
> </str>
> <str name="fl">dn, cn, t1, stat, pst, pct, ts, sv, score</str>
> <str name="mm">
> 2<-1 5<-2 6<90%
> </str>
> <int name="ps">100</int>
> <str name="q.alt">*:*</str>
> </lst>
> </requestHandler>
> <!-end snippet solrconfig.xml-->
>
Re: question regarding proper placement of geofilt in fq=
Posted by Bill Bell <bi...@gmail.com>.
Also _query_ is the right approach when using fq with 2 Boolean values. Just make sure you double quote the "{!geofilt}" when using that.
Bill Bell
Sent from mobile
On Mar 10, 2011, at 9:33 AM, Jerry Mindek <jm...@manta.com> wrote:
> Hi,
>
> I am using rev 1036236 of solr trunk running as a servlet in Tomcat 7.
> The doc set is sharded over 11 shards.
> Currently, I have all the shards running in a single tomcat.
>
> Please see the bottom of the email for the bits of my schema.xml and solrconfig.xml that might help you understand my configuration.
>
> I am seeing what I think is strange behavior when I try to use the geofilt in a filter query.
> Here's what I am seeing:
>
>
> 1. If put the {!geofilt} as the last argument of the fq= parameter and I send the following distributed query to my sharded index:
> /select?&start=0&rows=30&q=food&fq=b_type:shops AND {!geofilt}&qt=spatialdismax&fl=*%2Cscore&facet=false&pt=38.029191,-78.479266&sfield=lat_long&d=80&shards=...
> I get a syntax error. Which seems odd to me.
>
>
> 2. If I move the {!geofilt} to the first position in the fq= and send the following distributed query:
> /select?&start=0&rows=30&q=food&fq={!geofilt} AND b_type:T01&qt=spatialdismax&fl=*%2Cscore&facet=false&pt=38.029191,-78.479266&sfield=lat_long&d=80&shards=...
> Then only the geofilt is apply, not the b_type:T01. Which seems odd to me. I would expect both filters to be applied.
>
>
> 3. Finally, when I submit this query as:
> /select?&start=0&rows=30&q=food&fq=_query_:"{!geofilt} AND b_type:T01&qt=spatialdismax&fl=*%2Cscore&facet=false&pt=38.029191,-78.479266&sfield=lat_long&d=80&shards=...
> This works as I had hoped, i.e. both the geofilt and the b_type filters are applied.
>
> Am I trying to use geofilt in the wrong way or is this possibly a bug?
>
> Thanks,
> Jerry Mindek
>
>
> <!--schema.xml-->
> <field name="cn" type="text" indexed="true" stored="true" required="true" />
> <field name="dn" type="string" indexed="true" stored="true" required="false" />
> <field name="t1" type="text" indexed="true" stored="true" />
> <field name="ts" type="string" indexed="true" stored="true"/>
> <field name="lb" type="text" indexed="true" stored="false" />
> <field name="sim" type="string" indexed="true" stored="true" />
> <field name="s4_s" type="text" indexed="true" stored="false" />
> <field name="stat" type="string" indexed="true" stored="true" />
> <field name="pst" type="text" indexed="true" stored="true" />
> <fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
> ...
> <field name="type" b_type="string" indexed="true" stored="true"/>
> <field name="lat_long" type="location" indexed="true" stored="true" />
> <!-end snippet schema.xml-->
>
> <!-solrconfig.xml -->
> <requestHandler name="spatialdismax" class="solr.DisMaxRequestHandler" >
> <lst name="defaults">
> <str name="sort">score desc</str>
> <str name="facet">true</str>
> <str name="facet.mincount">1</str>
> <str name="echoParams">explicit</str>
> <int name="rows">20</int>
> <float name="tie">0.01</float>
> <str name="qf">
> cn^2.0 t1^2.0 ts^2.0 lb^2.0 s4_s^2.0 sim^2.0
> </str>
> <str name="pf">
> cn^2.0 t1^2.0 ts^2.0 lb^2.0 s4_s^2.0 sim^2.0
> </str>
> <str name="fl">dn, cn, t1, stat, pst, pct, ts, sv, score</str>
> <str name="mm">
> 2<-1 5<-2 6<90%
> </str>
> <int name="ps">100</int>
> <str name="q.alt">*:*</str>
> </lst>
> </requestHandler>
> <!-end snippet solrconfig.xml-->
>