Sort by distance not working

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Sort by distance not working

Mac_Weber
I'm using the example given by dsmiley:

q={!geofilt sfield=geo pt=45.15,-93.85 d=5 score=distance}&sort=score asc&fl=*,score

However, all scores are 1.0, making it impossible to sort.
It's on Solr 4.2
Reply | Threaded
Open this post in threaded view
|

Re: [Dev] Sort by distance not working

dsmiley
This question belongs on the solr-user list, not spatial4j. It has nothing to do with the shapes.

Is the type of "sfield" SpatialRecursivePrefixTreeFieldType ?  It needs to be for this method to work, not LatLonType.  I just tested this on 4.3.1 trivially with the example docs and it worked properly.  I believe it'll work on 4.2.

~ David

On Jul 9, 2013, at 11:29 PM, Mac_Weber <[hidden email]> wrote:

> I'm using the example given by dsmiley:
>
> q={!geofilt sfield=geo pt=45.15,-93.85 d=5 score=distance}&sort=score
> asc&fl=*,score
>
> However, all scores are 1.0, making it impossible to sort.
> It's on Solr 4.2
>
>
>
> --
> View this message in context: http://spatial4j.16575.x6.nabble.com/Sort-by-distance-not-working-tp5001160.html
> Sent from the Spatial4j mailing list archive at Nabble.com.
> _______________________________________________
> dev mailing list
> [hidden email]
> http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com

_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com
Reply | Threaded
Open this post in threaded view
|

Re: [Dev] Sort by distance not working

Mac_Weber
Thanks for the reply. Please send me the link of the other user group you mentioned if it still is the correct place to post this message.

It works if I add only class="SpatialRecursivePrefixTreeFieldType".
If I also add spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory" (as on the documentation), it returns these errors:

SEVERE: null:java.lang.NoClassDefFoundError: com/vividsolutions/jts/geom/Geometry
at com.spatial4j.core.context.jts.JtsSpatialContextFactory.newSpatialContext(JtsSpatialContextFactory.java:30)
at com.spatial4j.core.context.SpatialContextFactory.makeSpatialContext(SpatialContextFactory.java:83)
at org.apache.solr.schema.AbstractSpatialFieldType.init(AbstractSpatialFieldType.java:95)
at org.apache.solr.schema.AbstractSpatialPrefixTreeFieldType.init(AbstractSpatialPrefixTreeFieldType.java:43)
at org.apache.solr.schema.SpatialRecursivePrefixTreeFieldType.init(SpatialRecursivePrefixTreeFieldType.java:37)
at org.apache.solr.schema.FieldType.setArgs(FieldType.java:164)
at org.apache.solr.schema.FieldTypePluginLoader.init(FieldTypePluginLoader.java:142)
at org.apache.solr.schema.FieldTypePluginLoader.init(FieldTypePluginLoader.java:43)
at org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:190)
at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:373)
at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:121)
at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:1018)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:1051)
at org.apache.solr.core.CoreContainer$3.call(CoreContainer.java:634)
at org.apache.solr.core.CoreContainer$3.call(CoreContainer.java:629)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassNotFoundException: com.vividsolutions.jts.geom.Geometry
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:430)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:383)
... 23 more



On Wed, Jul 10, 2013 at 12:53 AM, David Smiley <[hidden email]> wrote:
This question belongs on the solr-user list, not spatial4j. It has nothing to do with the shapes.

Is the type of "sfield" SpatialRecursivePrefixTreeFieldType ?  It needs to be for this method to work, not LatLonType.  I just tested this on 4.3.1 trivially with the example docs and it worked properly.  I believe it'll work on 4.2.

~ David

On Jul 9, 2013, at 11:29 PM, Mac_Weber <[hidden email]> wrote:

> I'm using the example given by dsmiley:
>
> q={!geofilt sfield=geo pt=45.15,-93.85 d=5 score=distance}&sort=score
> asc&fl=*,score
>
> However, all scores are 1.0, making it impossible to sort.
> It's on Solr 4.2
>
>
>
> --
> View this message in context: http://spatial4j.16575.x6.nabble.com/Sort-by-distance-not-working-tp5001160.html
> Sent from the Spatial4j mailing list archive at Nabble.com.
> _______________________________________________
> dev mailing list
> [hidden email]
> http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com

_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com


_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com
Reply | Threaded
Open this post in threaded view
|

Re: [Dev] Sort by distance not working

dsmiley
The solr-user list is Solr's official community user list:
  FWIW I typically access it via Nabble: http://lucene.472066.n3.nabble.com/Solr-f472067.html

The docs for Solr 4's new spatial field type, including why you got the error you reported, is here:


On Wed, Jul 10, 2013 at 12:40 PM, Mac_Weber <[hidden email]> wrote:
Thanks for the reply. Please send me the link of the other user group you mentioned if it still is the correct place to post this message.

It works if I add only class="SpatialRecursivePrefixTreeFieldType".
If I also add spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory" (as on the documentation), it returns these errors:

SEVERE: null:java.lang.NoClassDefFoundError: com/vividsolutions/jts/geom/Geometry
at com.spatial4j.core.context.jts.JtsSpatialContextFactory.newSpatialContext(JtsSpatialContextFactory.java:30)
at com.spatial4j.core.context.SpatialContextFactory.makeSpatialContext(SpatialContextFactory.java:83)
at org.apache.solr.schema.AbstractSpatialFieldType.init(AbstractSpatialFieldType.java:95)
at org.apache.solr.schema.AbstractSpatialPrefixTreeFieldType.init(AbstractSpatialPrefixTreeFieldType.java:43)
at org.apache.solr.schema.SpatialRecursivePrefixTreeFieldType.init(SpatialRecursivePrefixTreeFieldType.java:37)
at org.apache.solr.schema.FieldType.setArgs(FieldType.java:164)
at org.apache.solr.schema.FieldTypePluginLoader.init(FieldTypePluginLoader.java:142)
at org.apache.solr.schema.FieldTypePluginLoader.init(FieldTypePluginLoader.java:43)
at org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:190)
at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:373)
at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:121)
at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:1018)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:1051)
at org.apache.solr.core.CoreContainer$3.call(CoreContainer.java:634)
at org.apache.solr.core.CoreContainer$3.call(CoreContainer.java:629)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassNotFoundException: com.vividsolutions.jts.geom.Geometry
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:430)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:383)
... 23 more



On Wed, Jul 10, 2013 at 12:53 AM, David Smiley <[hidden email]> wrote:
This question belongs on the solr-user list, not spatial4j. It has nothing to do with the shapes.

Is the type of "sfield" SpatialRecursivePrefixTreeFieldType ?  It needs to be for this method to work, not LatLonType.  I just tested this on 4.3.1 trivially with the example docs and it worked properly.  I believe it'll work on 4.2.

~ David

On Jul 9, 2013, at 11:29 PM, Mac_Weber <[hidden email]> wrote:

> I'm using the example given by dsmiley:
>
> q={!geofilt sfield=geo pt=45.15,-93.85 d=5 score=distance}&sort=score
> asc&fl=*,score
>
> However, all scores are 1.0, making it impossible to sort.
> It's on Solr 4.2
>
>
>
> --
> View this message in context: http://spatial4j.16575.x6.nabble.com/Sort-by-distance-not-working-tp5001160.html
> Sent from the Spatial4j mailing list archive at Nabble.com.
> _______________________________________________
> dev mailing list
> [hidden email]
> http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com

_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com


_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com



_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com