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 Viacheslav Davidovich <vi...@objectstyle.com> on 2012/11/26 07:33:38 UTC

Problem with migration to SolrAdaptersForLuceneSpatial4

Hi, 

I apologize for the question, but I can not find out what is wrong. I try to switch from Solr 3.5 to Solr 4.0. 

With Solr 3.5 I use SOLR-2155 plugin to filter the documents by distance as described in http://wiki.apache.org/solr/SpatialSearch#Advanced_Spatial_Search and this solution perfectly filter the required data.

the query looks like this with Solr 3.5:  q=*:*&fq={!geofilt}&sfield= some_loc&pt=45.15,-93.85&d=50&sort=geodist() asc

Unfortunately when I try to migrate to Solr4 to remove this plugin code usage from the app and add required modifications as described in http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4 the filter result is always empty for any request.

what I use: 
<fieldType name="location_rpt" class="solr.SpatialRecursivePrefixTreeFieldType"
			spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory" 
			distErrPct="0.025" maxDistErr="0.000009" units="degrees"
			geo="true" distCalculator="haversine"/>
to describe the field type

<field name="some_loc" type="location_rpt" indexed="true" stored="true" multiValued="true" boost="2.0"/>
to define the field properties

the query looks like this for Solr 4.0 :  &sort=score asc&q={! score=distance} some_loc:"Intersects(Circle(45.15,-93.85 d=50))"

For input I have the same long. and latt. coordinates and distance for both queries.

Latest JTS library included and available on classpath (as this required for spatialContextFactory).

All other migrated to Solr 4.0 parts works as expected, but this query always returns empty result. Could anybody say what I missed to add or made wrong? 

Thanks.

WBR Viacheslav.

Re: Problem with migration to SolrAdaptersForLuceneSpatial4

Posted by Viacheslav Davidovich <vi...@objectstyle.com>.
Yes, re-indexing is the first thing which I execute when field changed.

And now looks like migration to solr4 finished. 

Thanks you for your answers David. 

WBR Viacheslav.

On 28.11.2012, at 18:25, David Smiley (@MITRE.org) wrote:

> Viacheslav,
> Did you re-index?  Clearly re-indexing is needed when changing field types.
> ~ David
> ________________________________
> From: Viacheslav Davidovich [via Lucene] [ml-node+s472066n4022861h81@n3.nabble.com]
> Sent: Wednesday, November 28, 2012 4:42 AM
> To: Smiley, David W.
> Subject: Re: Problem with migration to SolrAdaptersForLuceneSpatial4
> 
> Hi David,
> 
> thank you for reply.
> 
> Actually when I change the fieldType to
> 
> <fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate" />
> 
> some magic happens and old query start to work.
> 
> And this change resolve my problems with distance calculation even without solr.SpatialRecursivePrefixTreeFieldType field type usage.
> 
> WBR Viacheslav.
> 
> On 26.11.2012, at 18:52, David Smiley (@MITRE.org) wrote:
> 
>> Hi Viacheslav,
>> 
>> 1. You don't need JTS unless you're using polygons or WKT and your examples
>> uses neither.  So you can remove the spatialContext attribute to use the
>> default, and remove the JTS jar.  But that shouldn't be related to your
>> reported problem.
>> 
>> 2. The units for d= in the circle are in degrees (111.2 km per degree) --
>> this is why units="degrees" on the field type.  Granted this
>> misunderstanding should yield a larger circle than what you intended, and so
>> doesn't explain your reported problem.
>> 
>> Honestly I'm a bit stumped as what you are doing should work.  I assume of
>> course you indexed your points into this field like <field
>> name="some_loc">45.15,-93.85</field>   Can you try varying some things, like
>> using a rectangle query, perhaps even of the whole world?  Remove
>> spatialContext attribute  (no need to re-index for points)?
>> 
>> By the way, the "boost" attribute on your field is strange to me; I didn't
>> know you could do that; are you sure you can?  I suspect it is erroneous.
>> 
>> ~ David
>> 
>> 
>> 
>> 
>> -----
>> Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
>> --
>> View this message in context: http://lucene.472066.n3.nabble.com/Problem-with-migration-to-SolrAdaptersForLuceneSpatial4-tp4022298p4022384.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>> 
> 
> 
> 
> ________________________________
> If you reply to this email, your message will be added to the discussion below:
> http://lucene.472066.n3.nabble.com/Problem-with-migration-to-SolrAdaptersForLuceneSpatial4-tp4022298p4022861.html
> To unsubscribe from Problem with migration to SolrAdaptersForLuceneSpatial4, click here<http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4022298&code=RFNNSUxFWUBtaXRyZS5vcmd8NDAyMjI5OHwxMDE2NDI2OTUw>.
> 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>
> 
> 
> 
> 
> -----
> Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Problem-with-migration-to-SolrAdaptersForLuceneSpatial4-tp4022298p4022959.html
> Sent from the Solr - User mailing list archive at Nabble.com.


RE: Problem with migration to SolrAdaptersForLuceneSpatial4

Posted by "David Smiley (@MITRE.org)" <DS...@mitre.org>.
Viacheslav,
Did you re-index?  Clearly re-indexing is needed when changing field types.
~ David
________________________________
From: Viacheslav Davidovich [via Lucene] [ml-node+s472066n4022861h81@n3.nabble.com]
Sent: Wednesday, November 28, 2012 4:42 AM
To: Smiley, David W.
Subject: Re: Problem with migration to SolrAdaptersForLuceneSpatial4

Hi David,

thank you for reply.

Actually when I change the fieldType to

<fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate" />

some magic happens and old query start to work.

And this change resolve my problems with distance calculation even without solr.SpatialRecursivePrefixTreeFieldType field type usage.

WBR Viacheslav.

On 26.11.2012, at 18:52, David Smiley (@MITRE.org) wrote:

> Hi Viacheslav,
>
> 1. You don't need JTS unless you're using polygons or WKT and your examples
> uses neither.  So you can remove the spatialContext attribute to use the
> default, and remove the JTS jar.  But that shouldn't be related to your
> reported problem.
>
> 2. The units for d= in the circle are in degrees (111.2 km per degree) --
> this is why units="degrees" on the field type.  Granted this
> misunderstanding should yield a larger circle than what you intended, and so
> doesn't explain your reported problem.
>
> Honestly I'm a bit stumped as what you are doing should work.  I assume of
> course you indexed your points into this field like <field
> name="some_loc">45.15,-93.85</field>   Can you try varying some things, like
> using a rectangle query, perhaps even of the whole world?  Remove
> spatialContext attribute  (no need to re-index for points)?
>
> By the way, the "boost" attribute on your field is strange to me; I didn't
> know you could do that; are you sure you can?  I suspect it is erroneous.
>
> ~ David
>
>
>
>
> -----
> Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Problem-with-migration-to-SolrAdaptersForLuceneSpatial4-tp4022298p4022384.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



________________________________
If you reply to this email, your message will be added to the discussion below:
http://lucene.472066.n3.nabble.com/Problem-with-migration-to-SolrAdaptersForLuceneSpatial4-tp4022298p4022861.html
To unsubscribe from Problem with migration to SolrAdaptersForLuceneSpatial4, click here<http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4022298&code=RFNNSUxFWUBtaXRyZS5vcmd8NDAyMjI5OHwxMDE2NDI2OTUw>.
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>




-----
 Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
--
View this message in context: http://lucene.472066.n3.nabble.com/Problem-with-migration-to-SolrAdaptersForLuceneSpatial4-tp4022298p4022959.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Problem with migration to SolrAdaptersForLuceneSpatial4

Posted by Viacheslav Davidovich <vi...@objectstyle.com>.
Hi David,

thank you for reply.

Actually when I change the fieldType to 

<fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate" />

some magic happens and old query start to work.

And this change resolve my problems with distance calculation even without solr.SpatialRecursivePrefixTreeFieldType field type usage.

WBR Viacheslav.

On 26.11.2012, at 18:52, David Smiley (@MITRE.org) wrote:

> Hi Viacheslav,
> 
> 1. You don't need JTS unless you're using polygons or WKT and your examples
> uses neither.  So you can remove the spatialContext attribute to use the
> default, and remove the JTS jar.  But that shouldn't be related to your
> reported problem.
> 
> 2. The units for d= in the circle are in degrees (111.2 km per degree) --
> this is why units="degrees" on the field type.  Granted this
> misunderstanding should yield a larger circle than what you intended, and so
> doesn't explain your reported problem.
> 
> Honestly I'm a bit stumped as what you are doing should work.  I assume of
> course you indexed your points into this field like <field
> name="some_loc">45.15,-93.85</field>   Can you try varying some things, like
> using a rectangle query, perhaps even of the whole world?  Remove
> spatialContext attribute  (no need to re-index for points)?
> 
> By the way, the "boost" attribute on your field is strange to me; I didn't
> know you could do that; are you sure you can?  I suspect it is erroneous.
> 
> ~ David
> 
> 
> 
> 
> -----
> Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Problem-with-migration-to-SolrAdaptersForLuceneSpatial4-tp4022298p4022384.html
> Sent from the Solr - User mailing list archive at Nabble.com.
> 


Re: Problem with migration to SolrAdaptersForLuceneSpatial4

Posted by "David Smiley (@MITRE.org)" <DS...@mitre.org>.
Hi Viacheslav,

1. You don't need JTS unless you're using polygons or WKT and your examples
uses neither.  So you can remove the spatialContext attribute to use the
default, and remove the JTS jar.  But that shouldn't be related to your
reported problem.

2. The units for d= in the circle are in degrees (111.2 km per degree) --
this is why units="degrees" on the field type.  Granted this
misunderstanding should yield a larger circle than what you intended, and so
doesn't explain your reported problem.

Honestly I'm a bit stumped as what you are doing should work.  I assume of
course you indexed your points into this field like <field
name="some_loc">45.15,-93.85</field>   Can you try varying some things, like
using a rectangle query, perhaps even of the whole world?  Remove
spatialContext attribute  (no need to re-index for points)?

By the way, the "boost" attribute on your field is strange to me; I didn't
know you could do that; are you sure you can?  I suspect it is erroneous.

~ David




-----
 Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
--
View this message in context: http://lucene.472066.n3.nabble.com/Problem-with-migration-to-SolrAdaptersForLuceneSpatial4-tp4022298p4022384.html
Sent from the Solr - User mailing list archive at Nabble.com.