Hi Dan, FYI the main reference page on this technique is here: http://wiki.apache.org/solr/SpatialForTimeDurations (note the slight buffering needed for the query shape).
You got the exception you got because you separated the dimensions of your query rectangle using a comma, which got Spatial4j confused as it thought you might be providing a point as "lat,lon". If you look carefully at how to do it, you're supposed to use a space. By the way, as of Solr 4.2, you can use Solr's range query syntax in spatial which I think is more clear. Less clear: grantRoundDates:"Intersects(0, 2013224, 2014231, 3000000)" More clear: grantRoundDates:["0 2013224" TO "2014231 3000000"] ~ David zonski wrote > Hi, > > I'm trying to implement date range searching using spatial features as > per: > http://lucene.472066.n3.nabble.com/Modeling-openinghours-using-multipoints-td4025336.html > > I've followed the steps and read through the linked articles but I can't > get past an exception: > > InvalidShapeException: Invalid longitude: longitudes are range > -180 to 180: provided lon: [2013224.0] > > I am trying to model date ranges so a thing (in my case a grant that you > can apply for) could be open open for a few months, then closes for a few > months, and then re-opens, etc. I want to find all grants that are open > for applicants in a specific date range (e.g. what can I apply for between > 1-Mar-2013 and 1-Apr-2013). > > I have a field type like so: > > > <fieldType name="date_range" > class="solr.SpatialRecursivePrefixTreeFieldType" > geo="false" > worldBounds="0 0 3000000 3000000" > distErrPct="0" > maxDistErr="1" > units="degrees" > /> > And a field like so: > > > <field name="grantRoundDates" type="date_range" indexed="true" > stored="true" required="false" multiValued="true"/> > Then I store values in this field, using a simple/rough calc of (year * > 1000 + dayOfYear). I know this is not a perfect mapping for duration but I > think it should be enough for my purposes and is easy to read/debug. > > So I end up with something like: > > > <field name="grantRoundDates"> > 2013224 2013301 > </field> > > > Then I query on this using something like: > > grantRoundDates:"Intersects(0, 2013224, 2014231, 3000000)" > > And I get the above exception about 2013224 not being a valid longitude. > I'm not sure why Solr is trying to convert this to Longitude when I have > geo=false but I admit my understanding of this whole space is pretty basic > at this stage. > > The examples in the links provided all use nice, small numbers. If I use > small numbers like this: > > grantRoundDates:"Intersects(0, 100, 100, 3000000)" > > Then it doesn't error but also returns no results (as expected). Am I > suppose to map my range to fit between -180 and 180, or there is something > more I have to do to get Solr to allow my larger numbers? > > Thanks, > Dan ----- Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book -- View this message in context: http://lucene.472066.n3.nabble.com/Multipoint-date-ranges-with-spatial-Invalid-Longitude-Exception-tp4083882p4084069.html Sent from the Solr - User mailing list archive at Nabble.com.