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 PeterKerk <ve...@hotmail.com> on 2010/10/13 01:49:48 UTC

Re: Spatial search in Solr 1.5

Hey Grant,

Just came accross this post of yours.

Run a query:  http://localhost:8983/solr/select/?q=_val_:"recip(dist(2,
store, vector(34.0232,-81.0664)),1,1,0)"&fl=*,score  // Note, I just updated
this, it used to be point instead of vector and that was wrong.

What does your suggested query actually do?

I really need great circle calcucation. Dont care if its from the trunk, as
long as I can have it in my projects asap :)

Thanks ahead!
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Spatial-search-in-Solr-1-5-tp489948p1691361.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Spatial search in Solr 1.5

Posted by da...@ontrenet.com.
Does the spatial constraints for laton types work for multivalued latlon
fields? Is there an example of it? using a field conjunction with > <
operators didn't work, last I checked.

> On Wed, Oct 13, 2010 at 7:28 AM, PeterKerk <ve...@hotmail.com> wrote:
>> Hi,
>>
>> Thanks for the quick reply :)
>>
>> I downloaded the latest version from the trunk. Got it up and running,
>> and
>> got the error below:
>
> Hopefully the QuickStart on the wiki all worked for you,
> but you only got the error when customizing your own config?
>
> Anyway, it looks like you haven't defined a _latLon dynamic field type
> for the lat / lon components.
>
> Here's what is in the example schema:
>
>    <fieldType name="location" class="solr.LatLonType"
> subFieldSuffix="_coordinate"/>
>    <dynamicField name="*_coordinate"  type="tdouble" indexed="true"
> stored="false"/>
>
>    <field name="store" type="location" indexed="true" stored="true"/>
>
> -Yonik
> http://www.lucidimagination.com
>
>> URL:
>> http://localhost:8983/solr/db/select/?wt=xml&indent=on&facet=true&fl=id,title,lat,lng,city&facet.field=province_raw&q=*:*&fq={!geofilt%20pt=45.15,-93.85%20sfield=geolocation%20d=5}
>>
>> HTTP ERROR 400
>>
>> Problem accessing /solr/db/select/. Reason:
>>
>>    undefined field geolocation_0_latLon
>>
>> Powered by Jetty://
>>
>>
>>
>> My field definition is:
>>
>> I added this in schema.xml:
>> <field name="geolocation" type="latLon" indexed="true" stored="true"/>
>> <fieldType name="latLon" class="solr.LatLonType"
>> subFieldSuffix="_latLon"/>
>>
>>
>> data-config.xml:
>> <entity name="location_geolocations" query="select (lat+','+lng) as
>> geoloc
>> FROM locations WHERE id='${location.id}'">
>>        <field name="geolocation" column="geoloc"  />
>> </entity>
>>
>>
>> I looked in the schema.xml of the latest download, but it turns out in
>> the
>> download there's nothing defined in that schema.xml on "latLon" type
>> either.
>>
>> Any suggestions what im doing wrong?
>>
>> Thanks!
>> --
>> View this message in context:
>> http://lucene.472066.n3.nabble.com/Spatial-search-in-Solr-1-5-tp489948p1693797.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>


Re: Spatial search in Solr 1.5

Posted by PeterKerk <ve...@hotmail.com>.
Arggghhh....I was working in OLD data-config...it now works! :)

Thanks, this is a GREAT addition. I do like to know when the final
implementation of this feature is implemented (as I understood it might
change in the final release).

Which issue can I subscribe to, to be informed?

Thanks again!!!
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Spatial-search-in-Solr-1-5-tp489948p1695051.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Spatial search in Solr 1.5

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Wed, Oct 13, 2010 at 10:06 AM, PeterKerk <ve...@hotmail.com> wrote:
>
> haha ;)
>
> But so I DO have the right solr version?
>
> Anyways...I have added the lines you mentioned, what else can I do?

The fact that the geolocation field does not show up in the results means that
it's not getting added (i.e. something is probably wrong with your DIH config).

-Yonik
http://www.lucidimagination.com

Re: Spatial search in Solr 1.5

Posted by PeterKerk <ve...@hotmail.com>.
haha ;)

But so I DO have the right solr version?

Anyways...I have added the lines you mentioned, what else can I do?

Thanks again!
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Spatial-search-in-Solr-1-5-tp489948p1694683.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Spatial search in Solr 1.5

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Wed, Oct 13, 2010 at 9:42 AM, PeterKerk <ve...@hotmail.com> wrote:
> Im now thinking I downloaded the wrong solr zip, I tried this one:
> https://hudson.apache.org/hudson/job/Solr-trunk/lastSuccessfulBuild/artifact/trunk/solr/dist/apache-solr-4.0-2010-10-12_08-05-48.zip
>
> In that example scheme
> (\apache-solr-4.0-2010-10-12_08-05-48\example\example-DIH\solr\db\conf\schema.xml)
> nothing is mentioned about a fieldtype of class solr.LatLonType.

Ah, right - DIH has a separate schema.   Blech.

-Yonik
http://www.lucidimagination.com

Re: Spatial search in Solr 1.5

Posted by PeterKerk <ve...@hotmail.com>.
Im now thinking I downloaded the wrong solr zip, I tried this one:
https://hudson.apache.org/hudson/job/Solr-trunk/lastSuccessfulBuild/artifact/trunk/solr/dist/apache-solr-4.0-2010-10-12_08-05-48.zip

In that example scheme
(\apache-solr-4.0-2010-10-12_08-05-48\example\example-DIH\solr\db\conf\schema.xml)
nothing is mentioned about a fieldtype of class solr.LatLonType.

But when I add the lines you suggested to my current schema.xml, I get no
error, so apparently the LatLonType IS found?

Here's what I now have in my schema.xml

<fieldType name="location" class="solr.LatLonType"
subFieldSuffix="_coordinate"/>	
<dynamicField name="*_coordinate"  type="tdouble" indexed="true"
stored="false"/>
<field name="geolocation" type="location" indexed="true" stored="true"/>

and this url:
http://localhost:8983/solr/db/select/?wt=xml&indent=on&facet=true&fl=id,title,lat,lng,city&facet.field=province_raw&q=*:*&fq={!geofilt%20pt=51.8316819,5.8151540%20sfield=geolocation%20d=500}


I also tried this:
http://localhost:8983/solr/db/select/?wt=xml&indent=on&facet=true&fl=id,title,lat,lng,geolocation,city&facet.field=province_raw&q=*:*

So WITHOUT the geofilter. Strange thing there is that the geolocation field
does not show up in the results (even though I restarted my app server,
reloaded my data-config and did a full import)
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Spatial-search-in-Solr-1-5-tp489948p1694443.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Spatial search in Solr 1.5

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Wed, Oct 13, 2010 at 7:28 AM, PeterKerk <ve...@hotmail.com> wrote:
> Hi,
>
> Thanks for the quick reply :)
>
> I downloaded the latest version from the trunk. Got it up and running, and
> got the error below:

Hopefully the QuickStart on the wiki all worked for you,
but you only got the error when customizing your own config?

Anyway, it looks like you haven't defined a _latLon dynamic field type
for the lat / lon components.

Here's what is in the example schema:

   <fieldType name="location" class="solr.LatLonType"
subFieldSuffix="_coordinate"/>
   <dynamicField name="*_coordinate"  type="tdouble" indexed="true"
stored="false"/>

   <field name="store" type="location" indexed="true" stored="true"/>

-Yonik
http://www.lucidimagination.com

> URL:
> http://localhost:8983/solr/db/select/?wt=xml&indent=on&facet=true&fl=id,title,lat,lng,city&facet.field=province_raw&q=*:*&fq={!geofilt%20pt=45.15,-93.85%20sfield=geolocation%20d=5}
>
> HTTP ERROR 400
>
> Problem accessing /solr/db/select/. Reason:
>
>    undefined field geolocation_0_latLon
>
> Powered by Jetty://
>
>
>
> My field definition is:
>
> I added this in schema.xml:
> <field name="geolocation" type="latLon" indexed="true" stored="true"/>
> <fieldType name="latLon" class="solr.LatLonType" subFieldSuffix="_latLon"/>
>
>
> data-config.xml:
> <entity name="location_geolocations" query="select (lat+','+lng) as geoloc
> FROM locations WHERE id='${location.id}'">
>        <field name="geolocation" column="geoloc"  />
> </entity>
>
>
> I looked in the schema.xml of the latest download, but it turns out in the
> download there's nothing defined in that schema.xml on "latLon" type either.
>
> Any suggestions what im doing wrong?
>
> Thanks!
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Spatial-search-in-Solr-1-5-tp489948p1693797.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Spatial search in Solr 1.5

Posted by PeterKerk <ve...@hotmail.com>.
Hi,

Thanks for the quick reply :)

I downloaded the latest version from the trunk. Got it up and running, and
got the error below:

URL:
http://localhost:8983/solr/db/select/?wt=xml&indent=on&facet=true&fl=id,title,lat,lng,city&facet.field=province_raw&q=*:*&fq={!geofilt%20pt=45.15,-93.85%20sfield=geolocation%20d=5}

HTTP ERROR 400

Problem accessing /solr/db/select/. Reason:

    undefined field geolocation_0_latLon

Powered by Jetty://


	
My field definition is:

I added this in schema.xml:
<field name="geolocation" type="latLon" indexed="true" stored="true"/>
<fieldType name="latLon" class="solr.LatLonType" subFieldSuffix="_latLon"/>


data-config.xml:             
<entity name="location_geolocations" query="select (lat+','+lng) as geoloc
FROM locations WHERE id='${location.id}'">
	<field name="geolocation" column="geoloc"  />
</entity>


I looked in the schema.xml of the latest download, but it turns out in the
download there's nothing defined in that schema.xml on "latLon" type either.

Any suggestions what im doing wrong?

Thanks!
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Spatial-search-in-Solr-1-5-tp489948p1693797.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Spatial search in Solr 1.5

Posted by Scott K <so...@skister.com>.
I just upgraded to a later version of the trunk and noticed my
geofilter queries stopped working, apparently because the sfilt
function was renamed to geofilt.

I realize trunk is not stable, but other than looking at every change,
is there an easy way to find changes that are not backward compatible
so developers know what they need to update when upgrading?

Thanks, Scott

On Tue, Oct 12, 2010 at 17:42, Yonik Seeley <yo...@lucidimagination.com> wrote:
> On Tue, Oct 12, 2010 at 8:07 PM, PeterKerk <ve...@hotmail.com> wrote:
>>
>> Ok, so does this actually say:
>> for now you have to do calculations based on bounding box instead of great
>> circle?
>
> I tried to make the documentation a little simpler... there's
>  - geofilt... filters within a radius of "d" km  (i.e. "great circle distance")
>  - bbox... filters using a bounding box
>  - geodist... function query that yields the distance (again, "great
> circle distance")
>
> If you point out the part to the docs you found confusing, I can try
> and improve it.
> Did you try and step through the quick start?  Those links actually work!
>
>> And the fact that on top of the page it says "Solr4.0", does that imply I
>> cant use this right now? Or where could I find the latest trunk for this?
>
> The wiki says "If you haven't already, get a recent nightly build of Solr4.0"...
> and links to the Solr4.0 page, which points to
> http://wiki.apache.org/solr/FrontPage#solr_development
> for nightly builds.
>
> -Yonik
>
> http://www.lucidimagination.com
>

Re: Spatial search in Solr 1.5

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Tue, Oct 12, 2010 at 8:07 PM, PeterKerk <ve...@hotmail.com> wrote:
>
> Ok, so does this actually say:
> for now you have to do calculations based on bounding box instead of great
> circle?

I tried to make the documentation a little simpler... there's
 - geofilt... filters within a radius of "d" km  (i.e. "great circle distance")
 - bbox... filters using a bounding box
 - geodist... function query that yields the distance (again, "great
circle distance")

If you point out the part to the docs you found confusing, I can try
and improve it.
Did you try and step through the quick start?  Those links actually work!

> And the fact that on top of the page it says "Solr4.0", does that imply I
> cant use this right now? Or where could I find the latest trunk for this?

The wiki says "If you haven't already, get a recent nightly build of Solr4.0"...
and links to the Solr4.0 page, which points to
http://wiki.apache.org/solr/FrontPage#solr_development
for nightly builds.

-Yonik

http://www.lucidimagination.com

Re: Spatial search in Solr 1.5

Posted by PeterKerk <ve...@hotmail.com>.
Ok, so does this actually say:
for now you have to do calculations based on bounding box instead of great
circle?

And the fact that on top of the page it says "Solr4.0", does that imply I
cant use this right now? Or where could I find the latest trunk for this?
(and ofcourse this might all change when the final solr version comes out
that supports this functionality)
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Spatial-search-in-Solr-1-5-tp489948p1691399.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Spatial search in Solr 1.5

Posted by Yonik Seeley <yo...@lucidimagination.com>.
You may want to check the docs, which were recently updated to reflect
the state of trunk:
http://wiki.apache.org/solr/SpatialSearch

-Yonik
http://www.lucidimagination.com



On Tue, Oct 12, 2010 at 7:49 PM, PeterKerk <ve...@hotmail.com> wrote:
>
> Hey Grant,
>
> Just came accross this post of yours.
>
> Run a query:  http://localhost:8983/solr/select/?q=_val_:"recip(dist(2,
> store, vector(34.0232,-81.0664)),1,1,0)"&fl=*,score  // Note, I just updated
> this, it used to be point instead of vector and that was wrong.
>
> What does your suggested query actually do?
>
> I really need great circle calcucation. Dont care if its from the trunk, as
> long as I can have it in my projects asap :)
>
> Thanks ahead!
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Spatial-search-in-Solr-1-5-tp489948p1691361.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>