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 solrnovice <ma...@yahoo.com> on 2011/08/26 16:29:33 UTC

Solr Geodist

Hi, i am trying to return distance in the solr query, by passing in the
"fl=geodist()" and i dont see distance being returned. 
We have a field called coordinates which is configured as latlong and when i
perform the following search, i do see results
q=*:*&fq={!geofilt}&sfield=coordinates&pt=31.2225,-85.3931&fl=id,name   =>
this works fine

q=*:*&fq={!geofilt}&sfield=coordinates&pt=31.2225,-85.3931&fl=id,name,geodist()  
=> this doesnt return distance


But when i add geodist() to the "fl parameter", i dont see the pseudo column
being returned. It returns the "id" and "name" only, but not the distance.
WE are using Solr 4.0. Can anybody please let me know what is wrong with the
query?  I also tried passing in the lat , long as arguments to the geodist,
but doesnt help.

I am totally lost in the solr system, can anybody please help?

thanks
SolrNovice



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Geodist-tp3287005p3287005.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr Geodist

Posted by solrnovice <ma...@yahoo.com>.
ok, thank you Erick, i will check this forum as well.


thanks
SN

--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Geodist-tp3287005p3300236.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr Geodist

Posted by Erick Erickson <er...@gmail.com>.
No, this form is part of the Apache Solr project. Lucid does maintain
a searchable index of this list though...

Best
Erick

On Tue, Aug 30, 2011 at 10:40 PM, solrnovice <ma...@yahoo.com> wrote:
> hi Lance, thanks for the link, i went to their site, lucidimagination forum,
> when i searched on geodist, i see my own posts. Is this forum part of
> lucidimagination?
>
> Just curious.
>
> thanks
> SN
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Solr-Geodist-tp3287005p3297262.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Solr Geodist

Posted by solrnovice <ma...@yahoo.com>.
hi Lance, thanks for the link, i went to their site, lucidimagination forum,
when i searched on geodist, i see my own posts. Is this forum part of
lucidimagination?

Just curious.

thanks
SN

--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Geodist-tp3287005p3297262.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr Geodist

Posted by Lance Norskog <go...@gmail.com>.
Lucid also has an online forum for questions about the LucidWorksEnterprise
product:

http://www.lucidimagination.com/forum/lwe

The Lucidi Imagination engineers all read the forum and endeavor to quickly
answer questions like this.

On Tue, Aug 30, 2011 at 6:09 PM, solrnovice <ma...@yahoo.com> wrote:

> hi Erik, today i had the distance working. Since the solr version under
> LucidImagination is not returning geodist(),  I downloaded Solr 4.0 from
> the
> nightly build. On lucid we had the full schema defined. So i copied that
> schema to the "example" directory of solr-4 and removed all references to
> Lucid and started the index.
> I wanted to try our schema under solr-4.
>
> Then i had the data indexed ( we have a rake written in ruby to index the
> contents) and ran the geodist queries and they all run like a charm. I do
> get distance as a pseudo column.
>
> Is there any documentation that gives me all the arguments of geodist(), i
> couldnt find it online.
>
>
> Erick, thanks for your help in going through my examples. NOw they all work
> on my solr installation.
>
>
> thanks
> SN
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Solr-Geodist-tp3287005p3297088.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
Lance Norskog
goksron@gmail.com

Re: Solr Geodist

Posted by Erick Erickson <er...@gmail.com>.
This is the one I've used,
http://wiki.apache.org/solr/SpatialSearch

Best
Erick

On Tue, Aug 30, 2011 at 9:09 PM, solrnovice <ma...@yahoo.com> wrote:
> hi Erik, today i had the distance working. Since the solr version under
> LucidImagination is not returning geodist(),  I downloaded Solr 4.0 from the
> nightly build. On lucid we had the full schema defined. So i copied that
> schema to the "example" directory of solr-4 and removed all references to
> Lucid and started the index.
> I wanted to try our schema under solr-4.
>
> Then i had the data indexed ( we have a rake written in ruby to index the
> contents) and ran the geodist queries and they all run like a charm. I do
> get distance as a pseudo column.
>
> Is there any documentation that gives me all the arguments of geodist(), i
> couldnt find it online.
>
>
> Erick, thanks for your help in going through my examples. NOw they all work
> on my solr installation.
>
>
> thanks
> SN
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Solr-Geodist-tp3287005p3297088.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Solr Geodist

Posted by solrnovice <ma...@yahoo.com>.
hi Erik, today i had the distance working. Since the solr version under
LucidImagination is not returning geodist(),  I downloaded Solr 4.0 from the
nightly build. On lucid we had the full schema defined. So i copied that
schema to the "example" directory of solr-4 and removed all references to
Lucid and started the index. 
I wanted to try our schema under solr-4.

Then i had the data indexed ( we have a rake written in ruby to index the
contents) and ran the geodist queries and they all run like a charm. I do
get distance as a pseudo column.

Is there any documentation that gives me all the arguments of geodist(), i
couldnt find it online.


Erick, thanks for your help in going through my examples. NOw they all work
on my solr installation.


thanks
SN

--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Geodist-tp3287005p3297088.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr Geodist

Posted by solrnovice <ma...@yahoo.com>.
Eric, can you please let me know the solr build, that you are using. I went
to this below site, but i want to use the same build, you are using, so i
can make sure the queries work.


http://wiki.apache.org/solr/FrontPage#solr_development


thanks
SN

--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Geodist-tp3287005p3296210.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr Geodist

Posted by solrnovice <ma...@yahoo.com>.
Eric, thank you for the quick update, so in the below query you sent to me, i
can also add any conditions right? i mean city:Boston and state:MA...etc ,
can i also use "dismax" query syntax?  

The confusion from the beginning seems to be the version of solr i was
trying and the one you are trying. Looks like the latest trunc of solr has
the geodist and the one i am using is not returning geodist. 


&q=*:*&sfield=store&pt=45.15,-93.85&fl=name,store,geodist() 



thanks
SN

--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Geodist-tp3287005p3295868.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr Geodist

Posted by Erick Erickson <er...@gmail.com>.
That should be fine. I'm not actually sure what version of Trunk I
have, I update it sporadically and build from scratch. But the "last
successful build" artifacts will certainly have the pseudo-field
return of function in it, so you should be fine.

Best
Erick

On Tue, Aug 30, 2011 at 2:33 PM, solrnovice <ma...@yahoo.com> wrote:
> I think i found the link to the nightly build, i am going to try this flavor
> of solr and run the query and check what happens.
> The link i am using is
> https://builds.apache.org/job/Solr-trunk/lastSuccessfulBuild/artifact/artifacts/
>
> thanks
> SN
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Solr-Geodist-tp3287005p3296316.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Solr Geodist

Posted by solrnovice <ma...@yahoo.com>.
I think i found the link to the nightly build, i am going to try this flavor
of solr and run the query and check what happens.
The link i am using is 
https://builds.apache.org/job/Solr-trunk/lastSuccessfulBuild/artifact/artifacts/

thanks
SN

--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Geodist-tp3287005p3296316.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr Geodist

Posted by Erick Erickson <er...@gmail.com>.
&q=*:*&sfield=store&pt=45.15,-93.85&fl=name,store,geodist()

Actually, you don't even have to specify the d=, I misunderstood.

Best
Erick

On Tue, Aug 30, 2011 at 9:56 AM, solrnovice <ma...@yahoo.com> wrote:
> hi Eric, thank you for the tip, i will try that option. Where can i find a
> document that shows details of geodist arguments, when i google, i did not
> find one.
> so this is what my query is like. I want the distance to be returned. i dont
> now exactly what all to pass to geodist, as i couldnt find a proper
> document.
>
> http://localhost:8888/solr/apex_dev/select/?q=city:Quincy&fl=city,state,coordinates,score,geodist(39.9435,-120.9226).
>
> So i want to pass in the long and lat of Quincy and then i want all the
> records which are tagged with Quincy should be returned ( as i am doing a
> q=city:Qunicy search)  and also distance to be displayed. Can you please let
> me know what i should pass into goedist(), in this scenario.
>
>
> thanks
> SN
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Solr-Geodist-tp3287005p3295606.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Solr Geodist

Posted by solrnovice <ma...@yahoo.com>.
hi Eric, thank you for the tip, i will try that option. Where can i find a
document that shows details of geodist arguments, when i google, i did not
find one. 
so this is what my query is like. I want the distance to be returned. i dont
now exactly what all to pass to geodist, as i couldnt find a proper
document. 

http://localhost:8888/solr/apex_dev/select/?q=city:Quincy&fl=city,state,coordinates,score,geodist(39.9435,-120.9226).

So i want to pass in the long and lat of Quincy and then i want all the
records which are tagged with Quincy should be returned ( as i am doing a
q=city:Qunicy search)  and also distance to be displayed. Can you please let
me know what i should pass into goedist(), in this scenario. 


thanks
SN

--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Geodist-tp3287005p3295606.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr Geodist

Posted by Erick Erickson <er...@gmail.com>.
Why couldn't you just give an outrageous distance (100000) or something?

You have to have some kind of point you're asking for the distance
*from*, don't you?

Best
Erick

On Mon, Aug 29, 2011 at 5:09 PM, solrnovice <ma...@yahoo.com> wrote:
> Eric, thanks for the update,  I thought solr 4.0 should have the pseudo
> columns and i am using the right version. So did you ever worked on a query
> to return distance, where there is no long, lat are used in the where
> clause. I mean not in a radial search, but a city search, but displayed the
> distance. So my thought was to pass in the long and lat to the geodist and
> also the coordinates(long and lat)  of every record, and let geodist compute
> the distance. Can you please let me know if this worked for you?
>
>
> thanks
> SN
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Solr-Geodist-tp3287005p3293779.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Solr Geodist

Posted by solrnovice <ma...@yahoo.com>.
Eric, thanks for the update,  I thought solr 4.0 should have the pseudo
columns and i am using the right version. So did you ever worked on a query
to return distance, where there is no long, lat are used in the where
clause. I mean not in a radial search, but a city search, but displayed the
distance. So my thought was to pass in the long and lat to the geodist and
also the coordinates(long and lat)  of every record, and let geodist compute
the distance. Can you please let me know if this worked for you?


thanks
SN

--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Geodist-tp3287005p3293779.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr Geodist

Posted by Erik Hatcher <er...@gmail.com>.
Based on the date, this was a LucidWorks Enterprise distribution that predated the addition of pseudo-fields to Solr for returning function values like that.  We have another release of LWE coming out, oh I dunno exactly, in a month or so?  It'll have the latest greatest Solr "4.0" (which is constantly changing, so there is no single "4.0" at this point).

	Erik

On Aug 29, 2011, at 15:33 , solrnovice wrote:

> hi Eric, thank you for the response. We use this product , which comes with
> solr, http://www.lucidimagination.com/.  
> They have a UI on top of solr, its easy to add fields or edit their
> properties using their UI.
> The queries I write are using the solr which comes with lucid imagination ,
> it says its SOLR version as below.
> 
> Solr Specification Version: 4.0.0.2011.03.21.13.41.34. 
> Solr Implementation Version: 4.0-SNAPSHOT exported - markrmiller -
> 2011-03-21 13:41:34
> Lucene Specification Version: 4.0-SNAPSHOT
> Lucene Implementation Version: 4.0-SNAPSHOT exported - 2011-03-21 13:42:35
> 
> I am assuming this is SOLR versin 4.0. I haven't downloaded just solr, and
> run my queries, i was using Lucidimagination's solr.  
> 
> Also is it possible to return the distance,  in the below scenario, we dont
> want to perform a lat long search. Suppose  the user types in
> "Jacksonville", "TN", can we run the query and return all the search
> results, and show the distance from Jacksonville TN on all search results. I
> mean we know the lat and long , but we dont want to use that and perform a
> radial search. We just want to perform a city, state search and return
> distance. I tried passing in fl=geodist(lat,
> long,coordinates_0_coordinate,coordinates_1_coordinate),score,name,street...etc, 
> where the coordinates_0 and coordinates_1 are the lat and long of all the
> records in the solr index. This is not returning the distance. 
> Can you please let me know if you tried this option?
> 
> 
> thanks
> SN
> 
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Solr-Geodist-tp3287005p3293551.html
> Sent from the Solr - User mailing list archive at Nabble.com.


Re: Solr Geodist

Posted by solrnovice <ma...@yahoo.com>.
hi Eric, thank you for the response. We use this product , which comes with
solr, http://www.lucidimagination.com/.  
They have a UI on top of solr, its easy to add fields or edit their
properties using their UI.
The queries I write are using the solr which comes with lucid imagination ,
it says its SOLR version as below.

Solr Specification Version: 4.0.0.2011.03.21.13.41.34. 
Solr Implementation Version: 4.0-SNAPSHOT exported - markrmiller -
2011-03-21 13:41:34
Lucene Specification Version: 4.0-SNAPSHOT
Lucene Implementation Version: 4.0-SNAPSHOT exported - 2011-03-21 13:42:35

I am assuming this is SOLR versin 4.0. I haven't downloaded just solr, and
run my queries, i was using Lucidimagination's solr.  

Also is it possible to return the distance,  in the below scenario, we dont
want to perform a lat long search. Suppose  the user types in
"Jacksonville", "TN", can we run the query and return all the search
results, and show the distance from Jacksonville TN on all search results. I
mean we know the lat and long , but we dont want to use that and perform a
radial search. We just want to perform a city, state search and return
distance. I tried passing in fl=geodist(lat,
long,coordinates_0_coordinate,coordinates_1_coordinate),score,name,street...etc, 
where the coordinates_0 and coordinates_1 are the lat and long of all the
records in the solr index. This is not returning the distance. 
Can you please let me know if you tried this option?


thanks
SN

--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Geodist-tp3287005p3293551.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr Geodist

Posted by Erick Erickson <er...@gmail.com>.
When you say you are using "LucidImagination", what is that?
The Dev version of LucidWorks? A certified distro (which I don't
think there are any for trunk)?

I'm using a recent (last week) trunk version that I built manually, but
I think this has been for a while....

Anyway, pasting in your field definition and query (from your
first post) returns the distance as a field just fine, so I suspect
something else you've changed somehow is interfering. Have
you re-indexed from scratch? I often delete the entire
data/index directory (directory to!). Or you have an
earlier version that I think you do, have you looked at the JIRA
to see when it was applied to trunk?

One approach would be to just start with a stock Solr and try
the example, and then build up gradually to where you are now
to see what change you might have introduced is the problem,
but that's a guess...

Best
Erick

On Fri, Aug 26, 2011 at 3:37 PM, solrnovice <ma...@yahoo.com> wrote:
> Eric, thanks for the quick response. I left out the "d" value, yes, when you
> perform a spatial query, we should have a distance of d>0, sorry about that.
>
> What is the setting of your "store" value, i mean in the schema, was it
> marked at LatLong. For some reason i dont see the geodist() being returned
> in the result set. my coordinates is setup as  "type=location", below is the
> snapshot from my schema.xml.
>
> <field indexed="true" multiValued="false" name="coordinates"
> omitNorms="false" omitTermFreqAndPositions="true" stored="true"
> termVectors="false" type="location"/>
>
>
> We are using LucidImagination, so i guess it comes with Solr 4.0, please let
> me know if i am wrong. That may be the reason for geodist() not being
> returned.I checked the solr version by going to solr admin and checked the
> version. it shows 4.0.
>
> For now i found a work around, this works for me. the distance is returned
> in the form of "score".
>
> http://127.0.0.1:8888/solr/apex_dev/select/?q=*:*+_val_:%22geodist%28%29%22&rows=100&fq={!geofilt}&sfield=coordinates&pt=31.2225,-85.3931&d=50&sort=geodist%28%29%20asc&fl=*,score
>
> I read in a different post that , earlier versions of solr ( prior to 4.0),
> we have to use the score option.
>
> thanks for taking time to try the query.
>
>
> SN
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Solr-Geodist-tp3287005p3287806.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Solr Geodist

Posted by solrnovice <ma...@yahoo.com>.
Eric, thanks for the quick response. I left out the "d" value, yes, when you
perform a spatial query, we should have a distance of d>0, sorry about that. 

What is the setting of your "store" value, i mean in the schema, was it
marked at LatLong. For some reason i dont see the geodist() being returned
in the result set. my coordinates is setup as  "type=location", below is the
snapshot from my schema.xml.

<field indexed="true" multiValued="false" name="coordinates"
omitNorms="false" omitTermFreqAndPositions="true" stored="true"
termVectors="false" type="location"/>


We are using LucidImagination, so i guess it comes with Solr 4.0, please let
me know if i am wrong. That may be the reason for geodist() not being
returned.I checked the solr version by going to solr admin and checked the
version. it shows 4.0. 

For now i found a work around, this works for me. the distance is returned
in the form of "score". 

http://127.0.0.1:8888/solr/apex_dev/select/?q=*:*+_val_:%22geodist%28%29%22&rows=100&fq={!geofilt}&sfield=coordinates&pt=31.2225,-85.3931&d=50&sort=geodist%28%29%20asc&fl=*,score

I read in a different post that , earlier versions of solr ( prior to 4.0),
we have to use the score option. 

thanks for taking time to try the query.


SN


--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-Geodist-tp3287005p3287806.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr Geodist

Posted by Erick Erickson <er...@gmail.com>.
When I try this form the stock solr example (using "store" rather than
"coordinate" for the field, your first example gives me an error of
"d must be > 0" or some such. When I add a "d" value to the query,
both your first and second queries work just fine and the second
returns a "geodist" value in the response.

You say you're using Solr 4.0. When did you get it? Have you tried
this with a very recent trunk?

Best
Erick

On Fri, Aug 26, 2011 at 10:29 AM, solrnovice <ma...@yahoo.com> wrote:
> Hi, i am trying to return distance in the solr query, by passing in the
> "fl=geodist()" and i dont see distance being returned.
> We have a field called coordinates which is configured as latlong and when i
> perform the following search, i do see results
> q=*:*&fq={!geofilt}&sfield=coordinates&pt=31.2225,-85.3931&fl=id,name   =>
> this works fine
>
> q=*:*&fq={!geofilt}&sfield=coordinates&pt=31.2225,-85.3931&fl=id,name,geodist()
> => this doesnt return distance
>
>
> But when i add geodist() to the "fl parameter", i dont see the pseudo column
> being returned. It returns the "id" and "name" only, but not the distance.
> WE are using Solr 4.0. Can anybody please let me know what is wrong with the
> query?  I also tried passing in the lat , long as arguments to the geodist,
> but doesnt help.
>
> I am totally lost in the solr system, can anybody please help?
>
> thanks
> SolrNovice
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Solr-Geodist-tp3287005p3287005.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>