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 Jon Chambers <jo...@relayrides.com> on 2013/03/06 22:31:45 UTC
InvalidShapeException when using SpatialRecursivePrefixTreeFieldType
with custom worldBounds
Hi there!
As suggested elsewhere
(http://lucene.472066.n3.nabble.com/Modeling-openinghours-using-multipoints-td4025336.html),
I'm trying to use spatial mapping to model intervals of availability.
I've defined the following fieldType in schema.xml:
<fieldType name="time_rpt"
class="solr.SpatialRecursivePrefixTreeFieldType" geo="false"
distErrPct="0.001" worldBounds="1362528000000 1362528000000
2524608000000 2524608000000" units="degrees" />
...and then I have a field like this:
<field name="availability" type="time_rpt" indexed="true"
stored="false" required="false" multiValued="true"/>
When I try to index a document (via solrj) with availability values in
the the worldBounds range, I get the following exception:
org.apache.solr.common.SolrException:
com.spatial4j.core.exception.InvalidShapeException: Invalid latitude:
latitudes are range -90 to 90: provided lat: [1.3626036E12]
at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:404)
at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:181)
at org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:117)
at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:116)
at org.apache.solr.client.solrj.SolrServer.addBean(SolrServer.java:136)
at org.apache.solr.client.solrj.SolrServer.addBean(SolrServer.java:125)
I've searched around a bit, and haven't found anybody else with this
problem. In fact, it sounds like lots of people are doing this kind of
thing with some success. I'm using solr 4.1.0; am I missing something?
Thanks very much!
-Jon
Re: InvalidShapeException when using
SpatialRecursivePrefixTreeFieldType with custom worldBounds
Posted by "David Smiley (@MITRE.org)" <DS...@mitre.org>.
Hi Jon.
If you're able to trigger an IndexOutOfBoundsException out of the prefix
tree then please file a bug (to the Lucene project, not Solr). I'll look
into it when I have time.
I need to add a Wiki page on the use of spatial for time ranges; there are
some tricks to it. Nevertheless you've demonstrated a bug.
~ David
-----
Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
--
View this message in context: http://lucene.472066.n3.nabble.com/InvalidShapeException-when-using-SpatialRecursivePrefixTreeFieldType-with-custom-worldBounds-tp4045351p4045864.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: InvalidShapeException when using SpatialRecursivePrefixTreeFieldType
with custom worldBounds
Posted by Lance Norskog <go...@gmail.com>.
Thank you (and Hoss)! I have found this concept elusive, and you two
have nailed it. I will be able to understand it for the 5 minutes I will
need to code with it.
Lance
On 03/09/2013 10:57 AM, David Smiley (@MITRE.org) wrote:
> Just finished:
> http://wiki.apache.org/solr/SpatialForTimeDurations
>
>
>
> -----
> Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
> --
> View this message in context: http://lucene.472066.n3.nabble.com/InvalidShapeException-when-using-SpatialRecursivePrefixTreeFieldType-with-custom-worldBounds-tp4045351p4045997.html
> Sent from the Solr - User mailing list archive at Nabble.com.
Re: InvalidShapeException when using
SpatialRecursivePrefixTreeFieldType with custom worldBounds
Posted by "David Smiley (@MITRE.org)" <DS...@mitre.org>.
Just finished:
http://wiki.apache.org/solr/SpatialForTimeDurations
-----
Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
--
View this message in context: http://lucene.472066.n3.nabble.com/InvalidShapeException-when-using-SpatialRecursivePrefixTreeFieldType-with-custom-worldBounds-tp4045351p4045997.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: InvalidShapeException when using SpatialRecursivePrefixTreeFieldType
with custom worldBounds
Posted by Jon Chambers <jo...@relayrides.com>.
I've managed to get this working by using smaller values in my
spatial-mapped-time field. The definition is now:
<fieldType name="time_rpt" class="solr.SpatialRecursivePrefixTreeFieldType"
geo="false" distErrPct="0" worldBounds="0 0 200000 200000"
units="degrees" />
The values I'm adding are now given in hours since a custom epoch,
which seems to be working well. My hunch is that using very large
values is causing the quadtree to partition itself down below
`maxLevels`, but I haven't investigated this thoroughly. Is this
something that should get taken up on the dev list?
Thanks!
-Jon
On Wed, Mar 6, 2013 at 6:11 PM, Jon Chambers <jo...@relayrides.com> wrote:
> Well, I've resolved one part of the problem, but run into another. I
> was specifying points as "%d,%d", which caused spatial4j to interpret
> them as lat/lon points (see
> https://github.com/spatial4j/spatial4j/blob/master/src/main/java/com/spatial4j/core/io/ShapeReadWriter.java#L145
> for the line in question). Now I'm formatting the points as "%d %d"
> (space instead of comma) and am running into the same issue as this
> gentleman: http://mail-archives.apache.org/mod_mbox/lucene-java-user/201302.mbox/%3C511D2B66.7090706@kodama.at%3E
>
> To summarize, it's an IndexOutOfBoundsException in
> QuadPrefixTree#getNode. The relevant part of the stack trace appears
> to be:
>
> Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
> at java.util.ArrayList.RangeCheck(ArrayList.java:547)
> at java.util.ArrayList.get(ArrayList.java:322)
> at org.apache.lucene.spatial.prefix.tree.QuadPrefixTree.getNode(QuadPrefixTree.java:146)
> at org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree.getNodesAltPoint(SpatialPrefixTree.java:201)
> at org.apache.lucene.spatial.prefix.tree.QuadPrefixTree.getNodes(QuadPrefixTree.java:162)
> at org.apache.lucene.spatial.prefix.PrefixTreeStrategy.createIndexableFields(PrefixTreeStrategy.java:127)
> at org.apache.lucene.spatial.prefix.PrefixTreeStrategy.createIndexableFields(PrefixTreeStrategy.java:122)
> at org.apache.solr.schema.AbstractSpatialFieldType.createFields(AbstractSpatialFieldType.java:123)
> at org.apache.solr.schema.AbstractSpatialFieldType.createFields(AbstractSpatialFieldType.java:63)
> at org.apache.solr.update.DocumentBuilder.addField(DocumentBuilder.java:193)
> at org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:269)
> ... 41 more
>
> I realize the original question didn't get answered (and feel bad
> repeating it effectively verbatim), but any suggestions would be
> greatly appreciated.
>
> -Jon
>
> On Wed, Mar 6, 2013 at 4:31 PM, Jon Chambers <jo...@relayrides.com> wrote:
>> Hi there!
>>
>> As suggested elsewhere
>> (http://lucene.472066.n3.nabble.com/Modeling-openinghours-using-multipoints-td4025336.html),
>> I'm trying to use spatial mapping to model intervals of availability.
>> I've defined the following fieldType in schema.xml:
>>
>> <fieldType name="time_rpt"
>> class="solr.SpatialRecursivePrefixTreeFieldType" geo="false"
>> distErrPct="0.001" worldBounds="1362528000000 1362528000000
>> 2524608000000 2524608000000" units="degrees" />
>>
>> ...and then I have a field like this:
>>
>> <field name="availability" type="time_rpt" indexed="true"
>> stored="false" required="false" multiValued="true"/>
>>
>> When I try to index a document (via solrj) with availability values in
>> the the worldBounds range, I get the following exception:
>>
>> org.apache.solr.common.SolrException:
>> com.spatial4j.core.exception.InvalidShapeException: Invalid latitude:
>> latitudes are range -90 to 90: provided lat: [1.3626036E12]
>> at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:404)
>> at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:181)
>> at org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:117)
>> at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:116)
>> at org.apache.solr.client.solrj.SolrServer.addBean(SolrServer.java:136)
>> at org.apache.solr.client.solrj.SolrServer.addBean(SolrServer.java:125)
>>
>> I've searched around a bit, and haven't found anybody else with this
>> problem. In fact, it sounds like lots of people are doing this kind of
>> thing with some success. I'm using solr 4.1.0; am I missing something?
>>
>> Thanks very much!
>>
>> -Jon
Re: InvalidShapeException when using SpatialRecursivePrefixTreeFieldType
with custom worldBounds
Posted by Jon Chambers <jo...@relayrides.com>.
Well, I've resolved one part of the problem, but run into another. I
was specifying points as "%d,%d", which caused spatial4j to interpret
them as lat/lon points (see
https://github.com/spatial4j/spatial4j/blob/master/src/main/java/com/spatial4j/core/io/ShapeReadWriter.java#L145
for the line in question). Now I'm formatting the points as "%d %d"
(space instead of comma) and am running into the same issue as this
gentleman: http://mail-archives.apache.org/mod_mbox/lucene-java-user/201302.mbox/%3C511D2B66.7090706@kodama.at%3E
To summarize, it's an IndexOutOfBoundsException in
QuadPrefixTree#getNode. The relevant part of the stack trace appears
to be:
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at org.apache.lucene.spatial.prefix.tree.QuadPrefixTree.getNode(QuadPrefixTree.java:146)
at org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree.getNodesAltPoint(SpatialPrefixTree.java:201)
at org.apache.lucene.spatial.prefix.tree.QuadPrefixTree.getNodes(QuadPrefixTree.java:162)
at org.apache.lucene.spatial.prefix.PrefixTreeStrategy.createIndexableFields(PrefixTreeStrategy.java:127)
at org.apache.lucene.spatial.prefix.PrefixTreeStrategy.createIndexableFields(PrefixTreeStrategy.java:122)
at org.apache.solr.schema.AbstractSpatialFieldType.createFields(AbstractSpatialFieldType.java:123)
at org.apache.solr.schema.AbstractSpatialFieldType.createFields(AbstractSpatialFieldType.java:63)
at org.apache.solr.update.DocumentBuilder.addField(DocumentBuilder.java:193)
at org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:269)
... 41 more
I realize the original question didn't get answered (and feel bad
repeating it effectively verbatim), but any suggestions would be
greatly appreciated.
-Jon
On Wed, Mar 6, 2013 at 4:31 PM, Jon Chambers <jo...@relayrides.com> wrote:
> Hi there!
>
> As suggested elsewhere
> (http://lucene.472066.n3.nabble.com/Modeling-openinghours-using-multipoints-td4025336.html),
> I'm trying to use spatial mapping to model intervals of availability.
> I've defined the following fieldType in schema.xml:
>
> <fieldType name="time_rpt"
> class="solr.SpatialRecursivePrefixTreeFieldType" geo="false"
> distErrPct="0.001" worldBounds="1362528000000 1362528000000
> 2524608000000 2524608000000" units="degrees" />
>
> ...and then I have a field like this:
>
> <field name="availability" type="time_rpt" indexed="true"
> stored="false" required="false" multiValued="true"/>
>
> When I try to index a document (via solrj) with availability values in
> the the worldBounds range, I get the following exception:
>
> org.apache.solr.common.SolrException:
> com.spatial4j.core.exception.InvalidShapeException: Invalid latitude:
> latitudes are range -90 to 90: provided lat: [1.3626036E12]
> at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:404)
> at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:181)
> at org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:117)
> at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:116)
> at org.apache.solr.client.solrj.SolrServer.addBean(SolrServer.java:136)
> at org.apache.solr.client.solrj.SolrServer.addBean(SolrServer.java:125)
>
> I've searched around a bit, and haven't found anybody else with this
> problem. In fact, it sounds like lots of people are doing this kind of
> thing with some success. I'm using solr 4.1.0; am I missing something?
>
> Thanks very much!
>
> -Jon