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 zonski <zo...@gmail.com> on 2013/08/12 03:25:23 UTC
Multipoint date ranges with spatial - Invalid Longitude Exception?
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
--
View this message in context: http://lucene.472066.n3.nabble.com/Multipoint-date-ranges-with-spatial-Invalid-Longitude-Exception-tp4083882.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Multipoint date ranges with spatial - Invalid Longitude
Exception?
Posted by zonski <zo...@gmail.com>.
Awesome, thanks - that fixed it and working perfectly now. The comma syntax
is a little cryptic but I can live with that.
And the new Intersects syntax is much easier to read so thanks for that too!
On Tue, Aug 13, 2013 at 5:52 AM, David Smiley (@MITRE.org) [via Lucene] <
ml-node+s472066n4084084h95@n3.nabble.com> wrote:
> Whoops; I copy'ed your error of using commas. I meant:
> Less clear: grantRoundDates:"Intersects(0 2013224 2014231 3000000)"
>
> More clear: grantRoundDates:["0 2013224" TO "2014231 3000000"]
>
>
> On 8/12/13 3:13 PM, "David Smiley (@MITRE.org)" <[hidden email]<http://user/SendEmail.jtp?type=node&node=4084084&i=0>>
> wrote:
>
> > Less clear: grantRoundDates:"Intersects(0, 2013224, 2014231, 3000000)"
> >
>
> Author:
> http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://lucene.472066.n3.nabble.com/Multipoint-date-ranges-with-spatial-Invalid-Longitude-Exception-tp4083882p4084084.html
> To unsubscribe from Multipoint date ranges with spatial - Invalid
> Longitude Exception?, click here<http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4083882&code=em9uc2tpQGdtYWlsLmNvbXw0MDgzODgyfC05MTE3MTQ5ODk=>
> .
> NAML<http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
View this message in context: http://lucene.472066.n3.nabble.com/Multipoint-date-ranges-with-spatial-Invalid-Longitude-Exception-tp4083882p4084164.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Multipoint date ranges with spatial - Invalid Longitude
Exception?
Posted by "Smiley, David W." <ds...@mitre.org>.
Whoops; I copy'ed your error of using commas. I meant:
Less clear: grantRoundDates:"Intersects(0 2013224 2014231 3000000)"
More clear: grantRoundDates:["0 2013224" TO "2014231 3000000"]
On 8/12/13 3:13 PM, "David Smiley (@MITRE.org)" <DS...@mitre.org> wrote:
> Less clear: grantRoundDates:"Intersects(0, 2013224, 2014231, 3000000)"
>
Re: Multipoint date ranges with spatial - Invalid Longitude
Exception?
Posted by "David Smiley (@MITRE.org)" <DS...@mitre.org>.
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.