Erick, Just checked on the separate fields and everything looks fine. One thing that I'm not completely sure is if this query I tried to perform is correct.
One sample document looks like this: <doc> <str name="id">200</str> <str name="local">-23.6696784,-46.7290193</str> <double name="local_0_coordinate">-23.6696784</double> <double name="local_1_coordinate">-46.7290193</double> </doc> So, to find for this document I tried to create a virtual rectangle that would be queried using the range query I described: http://localhost:8984/solr/select?q=*:*&fq=local:[-23.6677,-46.7315 TO -23.6709,-46.7261] You see that in the first coordinate I used a smaller value (got it from map) that is on the top left corner of the area of the doc. The other coordinate is on the bottom right corner, and it's bigger than the doc local field. When I split the query in 2 parts, the first part (local_1_coordinate:[-46.7315 TO -46.7261]) returns results but the other part (local_0_coordinate:[-23.6709 TO -23.6677]) doesn't match any docs. I am guessing that my query is wrong. The typical use case is to take the bounds of part of an map, that is represented by these top left and bottom right coordinates and find the docs inside this area. Does this range query accomplish this kind of scenario? Any pointers are appreciated. Best, Alexandre On Thu, Mar 29, 2012 at 3:54 PM, Erick Erickson <erickerick...@gmail.com>wrote: > This all looks fine, so the next question is whether or not your > documents have the value you think. > > +local_0_coordinate:[-23.6674 TO -23.6705] +local_1_coordinate:[-46.7314 TO > -46.7274] > is the actual translated filter. > > So I'd check the actual documents in the index to see if you have a single > document with local_0 and local_1 that fits the above. You should be able > to > use the TermsComponent: http://wiki.apache.org/solr/TermsComponent > to look. Or switch to stored="true" and look at search results for > documents you think should match, just to see the raw value.... Who knows? > It could be something as silly as you have your lat/lon backwards somehow, > I've > spent _days_ having problems like that <G>... > > Best > Erick > > On Thu, Mar 29, 2012 at 2:34 PM, Alexandre Rocco <alel...@gmail.com> > wrote: > > Erick, > > > > My location field is defined like in the example project: > > <field name="local" type="location" indexed="true" stored="true"/> > > > > Also, there is the dynamic that stores the splitted coordinates: > > <dynamicField name="*_coordinate" type="double" indexed="true" > > stored="false" multiValued="false"/> > > > > The response XML with debugQuery=on is looking like this: > > <response> > > <lst name="responseHeader"> > > <int name="status">0</int> > > <int name="QTime">1</int> > > </lst> > > <result name="response" numFound="0" start="0"/> > > <lst name="debug"> > > <str name="rawquerystring">*:*</str> > > <str name="querystring">*:*</str> > > <str name="parsedquery">MatchAllDocsQuery(*:*)</str> > > <str name="parsedquery_toString">*:*</str> > > <lst name="explain"/> > > <str name="QParser">LuceneQParser</str> > > <arr name="filter_queries"> > > <str>local:[-23.6674,-46.7314 TO -23.6705,-46.7274]</str> > > </arr> > > <arr name="parsed_filter_queries"> > > <str> > > +local_0_coordinate:[-23.6674 TO -23.6705] +local_1_coordinate:[-46.7314 > TO > > -46.7274] > > </str> > > </arr> > > <lst name="timing"> > > <double name="time">1.0</double> > > <lst name="prepare"> > > <double name="time">0.0</double> > > <lst name="org.apache.solr.handler.component.QueryComponent"> > > <double name="time">0.0</double> > > </lst> > > <lst name="org.apache.solr.handler.component.FacetComponent"> > > <double name="time">0.0</double> > > </lst> > > <lst name="org.apache.solr.handler.component.MoreLikeThisComponent"> > > <double name="time">0.0</double> > > </lst> > > <lst name="org.apache.solr.handler.component.HighlightComponent"> > > <double name="time">0.0</double> > > </lst> > > <lst name="org.apache.solr.handler.component.StatsComponent"> > > <double name="time">0.0</double> > > </lst> > > <lst name="org.apache.solr.handler.component.DebugComponent"> > > <double name="time">0.0</double> > > </lst> > > </lst> > > <lst name="process"> > > <double name="time">1.0</double> > > <lst name="org.apache.solr.handler.component.QueryComponent"> > > <double name="time">1.0</double> > > </lst> > > <lst name="org.apache.solr.handler.component.FacetComponent"> > > <double name="time">0.0</double> > > </lst> > > <lst name="org.apache.solr.handler.component.MoreLikeThisComponent"> > > <double name="time">0.0</double> > > </lst> > > <lst name="org.apache.solr.handler.component.HighlightComponent"> > > <double name="time">0.0</double> > > </lst> > > <lst name="org.apache.solr.handler.component.StatsComponent"> > > <double name="time">0.0</double> > > </lst> > > <lst name="org.apache.solr.handler.component.DebugComponent"> > > <double name="time">0.0</double> > > </lst> > > </lst> > > </lst> > > </lst> > > </response> > > > > I tried to get some docs that contains the coordinates and then created a > > retangle around that doc to see it is returned between these ranges. > > Don't know if this is the best way to test it, but it's quite easy. > > > > Best, > > Alexandre > > > > On Thu, Mar 29, 2012 at 2:57 PM, Erick Erickson <erickerick...@gmail.com > >wrote: > > > >> What are your results? Can you show us the field definition for "local" > >> and the results of adding &debugQuery=on? > >> > >> Because this should work as far as I can tell. > >> > >> Best > >> Erick > >> > >> On Thu, Mar 29, 2012 at 11:04 AM, Alexandre Rocco <alel...@gmail.com> > >> wrote: > >> > Hello, > >> > > >> > I'm trying to perform some queries on a location field on the index. > >> > The requirement is to search listings inside a pair of coordinates, > like > >> a > >> > bounding box. > >> > > >> > Taking a look on the wiki, I noticed that there is the option to use > the > >> > bbox query but in does not create a retangular shaped box to find the > >> docs. > >> > Also since the LatLon field is searchable by range, it's possible to > use > >> a > >> > range query to find. > >> > > >> > I'm trying to search inside a pair of coordinates (the top left corner > >> and > >> > bottom right corner) and no result is found. > >> > > >> > The query i'm trying is something like: > >> > > >> > http://localhost:8984/solr/select?wt=json&indent=true&fl=local,*&q=*:*&fq=local:[-23.6674,-46.7314TO > >> > -23.6705,-46.7274] > >> > > >> > Is there any other way to find docs inside a rectangular bounding box? > >> > > >> > Thanks > >> > Alexandre > >> >