Re: Spatial Search using two separate fields for lat and long

2019-04-13 Thread Alexandre Rafalovitch
Specifically, the pre-processing can be done with
UpdateRequestProcessors:
https://lucene.apache.org/solr/guide/7_2/update-request-processors.html

In your case, you probably want to chain
*) CloneUpdate:
http://www.solr-start.com/javadoc/solr-lucene/org/apache/solr/update/processor/CloneFieldUpdateProcessorFactory.html
*) ConcatField:
http://www.solr-start.com/javadoc/solr-lucene/org/apache/solr/update/processor/ConcatFieldUpdateProcessorFactory.html

Note that ConcatField URP inherits FieldMutating URP, so you have some
flexibility on how you define the fields:
http://www.solr-start.com/javadoc/solr-lucene/org/apache/solr/update/processor/FieldMutatingUpdateProcessorFactory.html

Set the target field to index-only (not stored) and it will only be
used for search. The original fields can be set to be not-indexed, as
David already explained.

Regards,
   Alex.

On Sat, 13 Apr 2019 at 23:50, David Smiley  wrote:
>
> Hi,
>
> I think your requirement of exporting back to CSV is fine but it's quite
> normal for there to be some transformation steps on input and/or output...
> and that such steps you mostly do yourself (not Solr).  That said, one
> straight-forward solution is to have your spatial field be redundant with
> the lat & lon separately.  Your spatial field could be stored=false, and
> the separate fields would be stored but otherwise not be indexed or have
> other characteristics that add weight.  The result is efficient; no
> redundancies.
>
> ~ David Smiley
> Apache Lucene/Solr Search Developer
> http://www.linkedin.com/in/davidwsmiley
>
>
> On Wed, Apr 3, 2019 at 1:54 AM Tim Hedlund  wrote:
>
> > Hi all,
> >
> > I'm importing documents (rows in excel file) that includes latitude and
> > longitude fields. I want to use those two separate fields for searching
> > with a bounding box. Is this possible (not using deprecated LatLonType) or
> > do I need to combine them into one single field when indexing? The reason I
> > want to keep the fields as two separate ones is that I want to be able to
> > export from solr back to exact same excel file structure, i.e. solr fields
> > maps exactly to excel columns.
> >
> > I'm using solr 7. Any thoughts or suggestions would be appreciated.
> >
> > Regards
> > Tim
> >
> >


Re: Spatial Search using two separate fields for lat and long

2019-04-13 Thread David Smiley
Hi,

I think your requirement of exporting back to CSV is fine but it's quite
normal for there to be some transformation steps on input and/or output...
and that such steps you mostly do yourself (not Solr).  That said, one
straight-forward solution is to have your spatial field be redundant with
the lat & lon separately.  Your spatial field could be stored=false, and
the separate fields would be stored but otherwise not be indexed or have
other characteristics that add weight.  The result is efficient; no
redundancies.

~ David Smiley
Apache Lucene/Solr Search Developer
http://www.linkedin.com/in/davidwsmiley


On Wed, Apr 3, 2019 at 1:54 AM Tim Hedlund  wrote:

> Hi all,
>
> I'm importing documents (rows in excel file) that includes latitude and
> longitude fields. I want to use those two separate fields for searching
> with a bounding box. Is this possible (not using deprecated LatLonType) or
> do I need to combine them into one single field when indexing? The reason I
> want to keep the fields as two separate ones is that I want to be able to
> export from solr back to exact same excel file structure, i.e. solr fields
> maps exactly to excel columns.
>
> I'm using solr 7. Any thoughts or suggestions would be appreciated.
>
> Regards
> Tim
>
>


Re: Spatial search - indexing WKT data

2018-01-17 Thread Gus Heck
It's been a while since I did it, but I'm pretty sure that when I indexed
polygons a couple years ago, I just sent WKT text for the field value... I
think i do recall some niggle where there was some slight mismatch in wkt
accepted by the javascript library I wanted to use and solr. (One was
slightly more permissive about something). As for fields I was using RPT
fields, which is more appropriate for arbitrary polygons I believe... also
note you may need to add JTS to solr as described here:
https://lucene.apache.org/solr/guide/7_2/spatial-search.html#jts-and-polygons-flat

I do think the Solr docs really should have examples of indexing these more
interesting field types. Presently the docs are pretty query focused...

On Sun, Jan 14, 2018 at 5:53 PM, Leila Deljkovic <
leila.deljko...@koordinates.com> wrote:

> Hi,
>
> I have some data in WKT string format (either POLYGON or MULTIPOLYGON) and
> I’d like to index it in Solr 7.0. As there are multiple polygons in every
> WKT string, I’d ideally like to index them multiValued BBoxField (couldn’t
> find anywhere to confirm, but it looks like multiValued is a valid
> attribute for BBoxField). Anyone indexed WKT data in Solr before? Is it
> necessary to convert it to CSV (I would do that first but I’m having
> trouble exporting it as CSV…)?
>
> Thanks




-- 
http://www.the111shift.com


Re: Spatial search (and nested docs)

2018-01-11 Thread Emir Arnautović
Hi Leila,
You should be able to pass score parameter that will tell how to combine 
children’s scores to parent’s score: 
https://lucene.apache.org/solr/guide/6_6/other-parsers.html#OtherParsers-Scoring

Maybe you could change approach and index each cell as a separate doc with 
layer field and use spatial to filter our covered cells and json faceting to 
sum density over layer field. Something like:

  top_layers:{ 
type: terms,
field: layer,
limit: 10,
sort: “total_density desc”,
facet:{
  total_density: “sum(density)”
}
  }

I didn’t use 

HTH,
Emir
--
Monitoring - Log Management - Alerting - Anomaly Detection
Solr & Elasticsearch Consulting Support Training - http://sematext.com/



> On 11 Jan 2018, at 00:02, Leila Deljkovic  
> wrote:
> 
> Hi Emir,
> 
> Thanks for the reply. My problem has been simplified a bit now. 
> 
> https://lucene.apache.org/solr/guide/7_0/uploading-data-with-index-handlers.html#UploadingDatawithIndexHandlers-NestedChildDocuments
>  
> 
> 
> I have never used nested documents, but a bit of background is that a spatial 
> data layer consisting of features (points, lines, polygons, or an aerial 
> image) is split up into sections (grid cells) based on the density of these 
> features over the layer; smaller grid cells indicate high density of features 
> in that area. 
> 
> I need to rank results based on density of features and whether dense areas 
> of the layer overlap with the region of space on a map I am searching in. 
> This is important because a layer could cover an entire country, for example 
> if I query for “roads”, the layer would be dense in urban areas as there are 
> more roads there, and less dense in rural areas, and if I am searching for a 
> particular city, this layer would be of interest to me even though it covers 
> the entire country. The idea is for the original layer to be the parent 
> document (which is what should be returned when a query is made), and the 
> child documents are the individual grid cells (which will hold the geometry 
> of the cell and a density field for the features inside the cell). 
> 
> I would like to know if it is possible to rank the parent document based on a 
> function which aggregates fields from the child documents (in this case, the 
> density field). There is not much info on this that I could find online.
> 
> Thanks
> 
>> On 10/01/2018, at 11:58 PM, Emir Arnautović  
>> wrote:
>> 
>> Hi Leila,
>> Maybe I need to refresh my spatial terminology, but I am having troubles 
>> following your case. Can you explain a bit more, what is dataset that is 
>> indexed and what are query inputs and what should be the result. The one 
>> thing that puzzles me the most is “nested documents”.
>> 
>> Thanks,
>> Emir
>> --
>> Monitoring - Log Management - Alerting - Anomaly Detection
>> Solr & Elasticsearch Consulting Support Training - http://sematext.com/
>> 
>> 
>> 
>>> On 10 Jan 2018, at 04:15, Leila Deljkovic  
>>> wrote:
>>> 
>>> Hi,
>>> 
>>> I’m quite new to Solr and am interested in using spatial search for 
>>> geospatial data (Solr 7.1).
>>> 
>>> One problem is addressing feature density over a layer and using this to 
>>> determine if a layer would be a relevant result over a search extent. I’d 
>>> like to know is it feasible/possible to “split” a data layer into nested 
>>> documents and index them, then at query time, count the number of nested 
>>> documents that coincide with the search extent. Or maybe make use of 
>>> overlapRatio or similar.
>>> 
>>> Thanks
>>> 
>>> 
>> 
> 



Re: Spatial search, nested docs, feature density

2018-01-10 Thread Mikhail Khludnev
The problem itself sounds really challenging, but literally two point from
the last question are:-
 -
https://lucene.apache.org/solr/guide/6_6/other-parsers.html#OtherParsers-Scoring
 - find field in
https://lucene.apache.org/solr/guide/6_6/function-queries.html#FunctionQueries-AvailableFunctions


On Thu, Jan 11, 2018 at 2:13 AM, Leila Deljkovic <
leila.deljko...@koordinates.com> wrote:

> Hi,
>
> https://lucene.apache.org/solr/guide/7_0/uploading-data-
> with-index-handlers.html#UploadingDatawithIndexHandlers
> -NestedChildDocuments  solr/guide/7_0/uploading-data-with-index-handlers.html#
> UploadingDatawithIndexHandlers-NestedChildDocuments>
>
> I have never used nested documents, but a bit of background on what I’m
> doing is that a spatial data layer consisting of features (points, lines,
> polygons, or an aerial image) is split up into sections (grid cells) based
> on the density of these features over the layer; smaller grid cells
> indicate high density of features in that area.
>
> I need to rank results based on density of features and whether dense
> areas of the layer overlap with the region of space on a map I am searching
> in. This is important because a layer could cover an entire country, for
> example if I query for “roads”, the layer would be dense in urban areas as
> there are more roads there, and less dense in rural areas, and if I am
> searching for a particular city, this layer would be of interest to me even
> though it covers the entire country. The idea is for the original layer to
> be the parent document (which is what should be returned when a query is
> made), and the child documents are the individual grid cells (which will
> hold the geometry of the cell and a density field for the features inside
> the cell).
>
> I would like to know if it is possible to rank the parent document based
> on a function which aggregates fields from the child documents (in this
> case, the density field). There is not much info on this that I could find
> online.
>
> Thanks




-- 
Sincerely yours
Mikhail Khludnev


Re: Spatial search (and nested docs)

2018-01-10 Thread Leila Deljkovic
Hi Emir,

Thanks for the reply. My problem has been simplified a bit now. 

https://lucene.apache.org/solr/guide/7_0/uploading-data-with-index-handlers.html#UploadingDatawithIndexHandlers-NestedChildDocuments
 


I have never used nested documents, but a bit of background is that a spatial 
data layer consisting of features (points, lines, polygons, or an aerial image) 
is split up into sections (grid cells) based on the density of these features 
over the layer; smaller grid cells indicate high density of features in that 
area. 

I need to rank results based on density of features and whether dense areas of 
the layer overlap with the region of space on a map I am searching in. This is 
important because a layer could cover an entire country, for example if I query 
for “roads”, the layer would be dense in urban areas as there are more roads 
there, and less dense in rural areas, and if I am searching for a particular 
city, this layer would be of interest to me even though it covers the entire 
country. The idea is for the original layer to be the parent document (which is 
what should be returned when a query is made), and the child documents are the 
individual grid cells (which will hold the geometry of the cell and a density 
field for the features inside the cell). 

I would like to know if it is possible to rank the parent document based on a 
function which aggregates fields from the child documents (in this case, the 
density field). There is not much info on this that I could find online.

Thanks

> On 10/01/2018, at 11:58 PM, Emir Arnautović  
> wrote:
> 
> Hi Leila,
> Maybe I need to refresh my spatial terminology, but I am having troubles 
> following your case. Can you explain a bit more, what is dataset that is 
> indexed and what are query inputs and what should be the result. The one 
> thing that puzzles me the most is “nested documents”.
> 
> Thanks,
> Emir
> --
> Monitoring - Log Management - Alerting - Anomaly Detection
> Solr & Elasticsearch Consulting Support Training - http://sematext.com/
> 
> 
> 
>> On 10 Jan 2018, at 04:15, Leila Deljkovic  
>> wrote:
>> 
>> Hi,
>> 
>> I’m quite new to Solr and am interested in using spatial search for 
>> geospatial data (Solr 7.1).
>> 
>> One problem is addressing feature density over a layer and using this to 
>> determine if a layer would be a relevant result over a search extent. I’d 
>> like to know is it feasible/possible to “split” a data layer into nested 
>> documents and index them, then at query time, count the number of nested 
>> documents that coincide with the search extent. Or maybe make use of 
>> overlapRatio or similar.
>> 
>> Thanks
>> 
>> 
> 



Re: Spatial search with arbitrary rectangle?

2017-08-29 Thread David Smiley
Hi,

The "rectangular area" refers to a hypothetical map UI.  In this scenario,
the UI ought to communicate the lat-lon of each corner.  The geofilt and
bbox query parsers don't handle that; they only take a point and distance.

RE projections: You may or may not need to care depending on exactly what
you're doing.  Most people by far don't need to care, I've found.
Basically:  If geo="true" on the spatial field (the default), then you work
in decimal degrees latitude,longitude.  Point-distance queries (i.e.
circles) use spherical geometry.  When geo="false", the units are whatever
you want them to be (there is no transformation; it's up to you to
transform them if needed), and a point-distance (circle) query is on the 2D
plane.  Other shapes (rectangles, line strings, polygons) use 2D Euclidean
geometry no matter if geo=true or false.

BTW sorry for my delayed response; I was on vacation.

~ David

On Wed, Aug 23, 2017 at 11:21 AM Paweł Kordek 
wrote:

> Hi All
>
>
> I've been skimming through the spatial search docs and came across this
> section:
>
>
>
> https://lucene.apache.org/solr/guide/6_6/spatial-search.html#SpatialSearch-Filteringbyanarbitraryrectangle
>
>
> "Sometimes the spatial search requirement calls for finding everything in
> a rectangular area, such as the area covered by a map the user is looking
> at. For this case, geofilt and bbox won’t cut it. "
>
>
> I can't understand what is meant here by the "rectangular area". What is
> the coordinate system of this rectangle? If we talk about the map, don't we
> have to consider what is the projection? Any help will be much appreciated.
>
>
> Best regards
>
> Paweł
>
> --
Lucene/Solr Search Committer, Consultant, Developer, Author, Speaker
LinkedIn: http://linkedin.com/in/davidwsmiley | Book:
http://www.solrenterprisesearchserver.com


Re: Spatial Search based on the amount of docs, not the distance

2017-06-28 Thread David Smiley
Deniz didn't mention document-to-document distance sort but he/she didn't say 
it wasn't that case either.

Any way, FYI at the Lucene level with LatLonPoint there is some sophisticated 
BKD search code to efficiently return the top N distance ordered documents 
(where you supply N).  Although as far as I recall, it also has no filtering 
mechanism, so if you have any other filters (keyword/time/whatever), it 
wouldn't work.

I once did this feature on an RPT index for a client and I got the open-source 
permission but I haven't gotten around to properly adding it to Solr.  I might 
approach it a bit differently now.

~ David

> On Jun 22, 2017, at 8:34 PM, Tim Casey  wrote:
> 
> deniz,
> 
> I was going to add something here.  The reason what you want is probably
> hard to do is because you are asking solr, which stores a document, to
> return documents using an attribute of document pairs.  As only a though
> exercise, if you stored record pairs as a single document, you could
> probably query it directly.  That is, if you have d1 and d2 and you are
> querying  around d1 and ordering by distance, then you could get this
> directly from a document representing a record pair.  I don't think this is
> practical, because it is an n^2 store.
> 
> Since the n^2 problem is there, people are going to suggest some heuristic
> which avoids this problem.  What Erick is suggesting is down this path.
> Query around a point and sort by distance taking the top K results.  The
> result is taking a linear slice of the n^2 distance attribute.
> 
> tim
> 
> 
> 
> On Wed, Jun 21, 2017 at 7:50 PM, Erick Erickson 
> wrote:
> 
>> Would it serve to sort by distance? True, if you matched a zillion
>> documents within a 1km radius you'd still perform the distance calcs, but
>> the result would be a manageable number.
>> 
>> I have to ask "Why to you care?". Is this an efficiency question (i.e. you
>> want to keep Solr from having to do expensive work) or is it a question of
>> having to get hits at all? It's at least possible that the solution for one
>> is not the solution for the other.
>> 
>> Best,
>> Erick
>> 
>> On Wed, Jun 21, 2017 at 5:32 PM, deniz  wrote:
>> 
>>> it is for sure possible to use d value for limiting the distance,
>> however,
>>> it
>>> might not be very efficient, as some of the coords may not have any docs
>>> around for a large value of d... so it is hard to determine a default
>> value
>>> for d.
>>> 
>>> though it sounds like havinga default d and gradual increments on its
>> value
>>> might be a work around for top K results...
>>> 
>>> 
>>> 
>>> 
>>> 
>>> -
>>> Zeki ama calismiyor... Calissa yapar...
>>> --
>>> View this message in context: http://lucene.472066.n3.
>>> nabble.com/Spatial-Search-based-on-the-amount-of-docs-not-the-distance-
>>> tp4342108p4342258.html
>>> Sent from the Solr - User mailing list archive at Nabble.com.
>>> 
>> 



Re: Spatial Search based on the amount of docs, not the distance

2017-06-22 Thread Tim Casey
deniz,

I was going to add something here.  The reason what you want is probably
hard to do is because you are asking solr, which stores a document, to
return documents using an attribute of document pairs.  As only a though
exercise, if you stored record pairs as a single document, you could
probably query it directly.  That is, if you have d1 and d2 and you are
querying  around d1 and ordering by distance, then you could get this
directly from a document representing a record pair.  I don't think this is
practical, because it is an n^2 store.

Since the n^2 problem is there, people are going to suggest some heuristic
which avoids this problem.  What Erick is suggesting is down this path.
Query around a point and sort by distance taking the top K results.  The
result is taking a linear slice of the n^2 distance attribute.

tim



On Wed, Jun 21, 2017 at 7:50 PM, Erick Erickson 
wrote:

> Would it serve to sort by distance? True, if you matched a zillion
> documents within a 1km radius you'd still perform the distance calcs, but
> the result would be a manageable number.
>
> I have to ask "Why to you care?". Is this an efficiency question (i.e. you
> want to keep Solr from having to do expensive work) or is it a question of
> having to get hits at all? It's at least possible that the solution for one
> is not the solution for the other.
>
> Best,
> Erick
>
> On Wed, Jun 21, 2017 at 5:32 PM, deniz  wrote:
>
> > it is for sure possible to use d value for limiting the distance,
> however,
> > it
> > might not be very efficient, as some of the coords may not have any docs
> > around for a large value of d... so it is hard to determine a default
> value
> > for d.
> >
> > though it sounds like havinga default d and gradual increments on its
> value
> > might be a work around for top K results...
> >
> >
> >
> >
> >
> > -
> > Zeki ama calismiyor... Calissa yapar...
> > --
> > View this message in context: http://lucene.472066.n3.
> > nabble.com/Spatial-Search-based-on-the-amount-of-docs-not-the-distance-
> > tp4342108p4342258.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
> >
>


Re: Spatial Search based on the amount of docs, not the distance

2017-06-21 Thread Erick Erickson
Would it serve to sort by distance? True, if you matched a zillion
documents within a 1km radius you'd still perform the distance calcs, but
the result would be a manageable number.

I have to ask "Why to you care?". Is this an efficiency question (i.e. you
want to keep Solr from having to do expensive work) or is it a question of
having to get hits at all? It's at least possible that the solution for one
is not the solution for the other.

Best,
Erick

On Wed, Jun 21, 2017 at 5:32 PM, deniz  wrote:

> it is for sure possible to use d value for limiting the distance, however,
> it
> might not be very efficient, as some of the coords may not have any docs
> around for a large value of d... so it is hard to determine a default value
> for d.
>
> though it sounds like havinga default d and gradual increments on its value
> might be a work around for top K results...
>
>
>
>
>
> -
> Zeki ama calismiyor... Calissa yapar...
> --
> View this message in context: http://lucene.472066.n3.
> nabble.com/Spatial-Search-based-on-the-amount-of-docs-not-the-distance-
> tp4342108p4342258.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>


Re: Spatial Search based on the amount of docs, not the distance

2017-06-21 Thread deniz
it is for sure possible to use d value for limiting the distance, however, it
might not be very efficient, as some of the coords may not have any docs
around for a large value of d... so it is hard to determine a default value
for d. 

though it sounds like havinga default d and gradual increments on its value
might be a work around for top K results... 





-
Zeki ama calismiyor... Calissa yapar...
--
View this message in context: 
http://lucene.472066.n3.nabble.com/Spatial-Search-based-on-the-amount-of-docs-not-the-distance-tp4342108p4342258.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Spatial Search based on the amount of docs, not the distance

2017-06-21 Thread alessandro.benedetti
As any other search you can paginate playing with the 'row' and 'start'
parameters ( or cursors if you want to go deep), show only the first K
results is your responsibility.

Is it not possible in your domain to identify a limit d ( out of that your
results will lose meaning ?)

You can not match documents based on the score, first you match and then you
score.
After you have scored and you ranked your results by distance, you can
return the top K as any other query.

If there are other criterias for you to match the documents you can just
boost by distance[1] and then return the top K you like.


[1] https://cwiki.apache.org/confluence/display/solr/Spatial+Search 



-
---
Alessandro Benedetti
Search Consultant, R Software Engineer, Director
Sease Ltd. - www.sease.io
--
View this message in context: 
http://lucene.472066.n3.nabble.com/Spatial-Search-based-on-the-amount-of-docs-not-the-distance-tp4342108p4342142.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Spatial Search: can not use FieldCache on a field which is neither indexed nor has doc values: latitudeLongitude_0_coordinate

2017-04-30 Thread David Smiley
Frederick,

RE LatLonType: Weird. Is the dynamic field "_coordinate" defined?  It
should be ensure it has indexed=true on it.  I forget if indexed needs
to be set on that or on the LLT field that refers to it but to be sure set
on both.

RE LatLonPointSpatialField: You should use this for sure assuming you are
using the latest Solr release (6.5.x).  You said "Solr version 6.1.0" which
doesn't have this field type though.

~ David

On Thu, Apr 27, 2017 at 8:26 AM freddy79 
wrote:

> Hi,
>
> when doing a query with spatial search i get the error: can not use
> FieldCache on a field which is neither indexed nor has doc values:
> latitudeLongitude_0_coordinate
>
> *SOLR Version:* 6.1.0
> *schema.xml:*
>
>  subFieldSuffix="_coordinate" />
>  stored="false" multiValued="false"  />
>
> *Query:*
>
> http://localhost:8983/solr/career_educationVacancyLocation/select?q=*:*={!geofilt}=latitudeLongitude=48.15,16.23=10
>
> *Error Message:*
> can not use FieldCache on a field which is neither indexed nor has doc
> values: latitudeLongitude_0_coordinate
>
> What is wrong? Thanks.
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Spatial-Search-can-not-use-FieldCache-on-a-field-which-is-neither-indexed-nor-has-doc-values-latitude-tp4332185.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
-- 
Lucene/Solr Search Committer, Consultant, Developer, Author, Speaker
LinkedIn: http://linkedin.com/in/davidwsmiley | Book:
http://www.solrenterprisesearchserver.com


Re: Spatial Search: can not use FieldCache on a field which is neither indexed nor has doc values: latitudeLongitude_0_coordinate

2017-04-27 Thread freddy79
It does work with "solr.LatLonPointSpatialField" instead of
"solr.LatLonType".



But why not with "solr.LatLonType"?



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Spatial-Search-can-not-use-FieldCache-on-a-field-which-is-neither-indexed-nor-has-doc-values-latitude-tp4332185p4332199.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Spatial Search on Postal Code

2016-03-07 Thread Manohar Sripada
Thanks Again Emir! I will try this way.

Thanks David! It looks like building of polygons at index time is better
option than at query time.

Thanks,
Manohar

On Sat, Mar 5, 2016 at 7:54 PM, david.w.smi...@gmail.com <
david.w.smi...@gmail.com> wrote:

> Another path to consider is doing this point-in-zipcode-poly lookup at
> index time and enriching the document with a zipcode field (possibly
> multi-valued if there is doubt).
>
> On Sat, Mar 5, 2016 at 4:05 AM steve shepard <sc_shep...@hotmail.com>
> wrote:
>
> > re: Postal Codes and polygons. I've heard of basic techniques that use
> > Commerce Department (or was it Census within Commerce??) that give the
> > basic points, but the real run is deciding what the "center" of that
> > polygon is. There is likely a commercial solution available, and
> certainly
> > you can buy a spreadsheet with the zipcodes and their guestimated center.
> > Fun project!
> >
> > > Subject: Re: Spatial Search on Postal Code
> > > To: solr-user@lucene.apache.org
> > > From: emir.arnauto...@sematext.com
> > > Date: Fri, 4 Mar 2016 21:18:10 +0100
> > >
> > > Hi Manohar,
> > > I don't think there is such functionality in Solr - you need to do it
> on
> > > client side:
> > > 1. find some postal code polygons (you can use open street map -
> > > http://wiki.openstreetmap.org/wiki/Key:postal_code)
> > > 2. create zip to polygon lookup
> > > 3. create code that will expand zip code polygon by some distance (you
> > > can use JTS buffer api)
> > >
> > > On query time you get zip code and distance:
> > > 1. find polygon for zip
> > > 2. expand polygon
> > > 3. send resulting polygon to Solr and use Intersects function to filter
> > > results
> > >
> > > Regards,
> > > Emir
> > >
> > > On 04.03.2016 19:49, Manohar Sripada wrote:
> > > > Thanks Emir,
> > > >
> > > > Obviously #2 approach is much better. I know its not straight
> forward.
> > But,
> > > > is it really acheivable in Solr? Like building a polygon for a postal
> > code.
> > > > If so, can you throw some light how to do?
> > > >
> > > > Thanks,
> > > > Manohar
> > > >
> > > > On Friday, March 4, 2016, Emir Arnautovic <
> > emir.arnauto...@sematext.com>
> > > > wrote:
> > > >
> > > >> Hi Manohar,
> > > >> This depends on your requirements/usecase. If postal code is
> > interpreted
> > > >> as point than it is expected to have radius that is significantly
> > larger
> > > >> than postal code diameter. In such case you can go with first
> > approach. In
> > > >> order to avoid missing results from postal code in case of small
> > search
> > > >> radius and large postal code, you can reverse geocode records and
> > store
> > > >> postal code with each document.
> > > >> If you need to handle distance from postal code precisely - distance
> > from
> > > >> its border, you have to get postal code polygon, expand it by search
> > > >> distance and use resulting polygon to find matches.
> > > >>
> > > >> HTH,
> > > >> Emir
> > > >>
> > > >> On 04.03.2016 13:09, Manohar Sripada wrote:
> > > >>
> > > >>> Here's my requirement -  User enters postal code and provides the
> > radius.
> > > >>> I
> > > >>> need to find the records with in the radius from the provided
> postal
> > code.
> > > >>>
> > > >>> There are few ways I thought through after going through the
> "Spatial
> > > >>> Search" Solr wiki
> > > >>>
> > > >>> 1. As Latitude and Longitude positions are required for spatial
> > search.
> > > >>> Get
> > > >>> Latitude Longitude position (may be using GeoCoding API) of a
> postal
> > code
> > > >>> and use "LatLonType" field type and query accordingly. As the
> > GeoCoding
> > > >>> API
> > > >>> returns one point and if the postal code area is too big, then I
> may
> > end
> > > >>> up
> > > >>> not getting any results (apart from the records from the same
> postal
> > code)
> > > >>> if the radius provided is small.
> > > >>>
> > > >>> 2. Get the latitude longitude points of the postal code which
> forms a
> > > >>> border (not sure yet on how to get) and build a polygon (using
> RPT).
> > While
> > > >>> querying use this polygon and provide the distance. Can this be
> > achieved?
> > > >>> Or Am I ruminating too much? :(
> > > >>>
> > > >>> Appreciate any help on this.
> > > >>>
> > > >>> Thanks
> > > >>>
> > > >>>
> > > >> --
> > > >> Monitoring * Alerting * Anomaly Detection * Centralized Log
> Management
> > > >> Solr & Elasticsearch Support * http://sematext.com/
> > > >>
> > > >>
> > >
> > > --
> > > Monitoring * Alerting * Anomaly Detection * Centralized Log Management
> > > Solr & Elasticsearch Support * http://sematext.com/
> > >
> >
>
> --
> Lucene/Solr Search Committer, Consultant, Developer, Author, Speaker
> LinkedIn: http://linkedin.com/in/davidwsmiley | Book:
> http://www.solrenterprisesearchserver.com
>


Re: Spatial Search on Postal Code

2016-03-05 Thread david.w.smi...@gmail.com
Another path to consider is doing this point-in-zipcode-poly lookup at
index time and enriching the document with a zipcode field (possibly
multi-valued if there is doubt).

On Sat, Mar 5, 2016 at 4:05 AM steve shepard <sc_shep...@hotmail.com> wrote:

> re: Postal Codes and polygons. I've heard of basic techniques that use
> Commerce Department (or was it Census within Commerce??) that give the
> basic points, but the real run is deciding what the "center" of that
> polygon is. There is likely a commercial solution available, and certainly
> you can buy a spreadsheet with the zipcodes and their guestimated center.
> Fun project!
>
> > Subject: Re: Spatial Search on Postal Code
> > To: solr-user@lucene.apache.org
> > From: emir.arnauto...@sematext.com
> > Date: Fri, 4 Mar 2016 21:18:10 +0100
> >
> > Hi Manohar,
> > I don't think there is such functionality in Solr - you need to do it on
> > client side:
> > 1. find some postal code polygons (you can use open street map -
> > http://wiki.openstreetmap.org/wiki/Key:postal_code)
> > 2. create zip to polygon lookup
> > 3. create code that will expand zip code polygon by some distance (you
> > can use JTS buffer api)
> >
> > On query time you get zip code and distance:
> > 1. find polygon for zip
> > 2. expand polygon
> > 3. send resulting polygon to Solr and use Intersects function to filter
> > results
> >
> > Regards,
> > Emir
> >
> > On 04.03.2016 19:49, Manohar Sripada wrote:
> > > Thanks Emir,
> > >
> > > Obviously #2 approach is much better. I know its not straight forward.
> But,
> > > is it really acheivable in Solr? Like building a polygon for a postal
> code.
> > > If so, can you throw some light how to do?
> > >
> > > Thanks,
> > > Manohar
> > >
> > > On Friday, March 4, 2016, Emir Arnautovic <
> emir.arnauto...@sematext.com>
> > > wrote:
> > >
> > >> Hi Manohar,
> > >> This depends on your requirements/usecase. If postal code is
> interpreted
> > >> as point than it is expected to have radius that is significantly
> larger
> > >> than postal code diameter. In such case you can go with first
> approach. In
> > >> order to avoid missing results from postal code in case of small
> search
> > >> radius and large postal code, you can reverse geocode records and
> store
> > >> postal code with each document.
> > >> If you need to handle distance from postal code precisely - distance
> from
> > >> its border, you have to get postal code polygon, expand it by search
> > >> distance and use resulting polygon to find matches.
> > >>
> > >> HTH,
> > >> Emir
> > >>
> > >> On 04.03.2016 13:09, Manohar Sripada wrote:
> > >>
> > >>> Here's my requirement -  User enters postal code and provides the
> radius.
> > >>> I
> > >>> need to find the records with in the radius from the provided postal
> code.
> > >>>
> > >>> There are few ways I thought through after going through the "Spatial
> > >>> Search" Solr wiki
> > >>>
> > >>> 1. As Latitude and Longitude positions are required for spatial
> search.
> > >>> Get
> > >>> Latitude Longitude position (may be using GeoCoding API) of a postal
> code
> > >>> and use "LatLonType" field type and query accordingly. As the
> GeoCoding
> > >>> API
> > >>> returns one point and if the postal code area is too big, then I may
> end
> > >>> up
> > >>> not getting any results (apart from the records from the same postal
> code)
> > >>> if the radius provided is small.
> > >>>
> > >>> 2. Get the latitude longitude points of the postal code which forms a
> > >>> border (not sure yet on how to get) and build a polygon (using RPT).
> While
> > >>> querying use this polygon and provide the distance. Can this be
> achieved?
> > >>> Or Am I ruminating too much? :(
> > >>>
> > >>> Appreciate any help on this.
> > >>>
> > >>> Thanks
> > >>>
> > >>>
> > >> --
> > >> Monitoring * Alerting * Anomaly Detection * Centralized Log Management
> > >> Solr & Elasticsearch Support * http://sematext.com/
> > >>
> > >>
> >
> > --
> > Monitoring * Alerting * Anomaly Detection * Centralized Log Management
> > Solr & Elasticsearch Support * http://sematext.com/
> >
>

-- 
Lucene/Solr Search Committer, Consultant, Developer, Author, Speaker
LinkedIn: http://linkedin.com/in/davidwsmiley | Book:
http://www.solrenterprisesearchserver.com


RE: Spatial Search on Postal Code

2016-03-05 Thread steve shepard
re: Postal Codes and polygons. I've heard of basic techniques that use Commerce 
Department (or was it Census within Commerce??) that give the basic points, but 
the real run is deciding what the "center" of that polygon is. There is likely 
a commercial solution available, and certainly you can buy a spreadsheet with 
the zipcodes and their guestimated center. Fun project!

> Subject: Re: Spatial Search on Postal Code
> To: solr-user@lucene.apache.org
> From: emir.arnauto...@sematext.com
> Date: Fri, 4 Mar 2016 21:18:10 +0100
> 
> Hi Manohar,
> I don't think there is such functionality in Solr - you need to do it on 
> client side:
> 1. find some postal code polygons (you can use open street map - 
> http://wiki.openstreetmap.org/wiki/Key:postal_code)
> 2. create zip to polygon lookup
> 3. create code that will expand zip code polygon by some distance (you 
> can use JTS buffer api)
> 
> On query time you get zip code and distance:
> 1. find polygon for zip
> 2. expand polygon
> 3. send resulting polygon to Solr and use Intersects function to filter 
> results
> 
> Regards,
> Emir
> 
> On 04.03.2016 19:49, Manohar Sripada wrote:
> > Thanks Emir,
> >
> > Obviously #2 approach is much better. I know its not straight forward. But,
> > is it really acheivable in Solr? Like building a polygon for a postal code.
> > If so, can you throw some light how to do?
> >
> > Thanks,
> > Manohar
> >
> > On Friday, March 4, 2016, Emir Arnautovic <emir.arnauto...@sematext.com>
> > wrote:
> >
> >> Hi Manohar,
> >> This depends on your requirements/usecase. If postal code is interpreted
> >> as point than it is expected to have radius that is significantly larger
> >> than postal code diameter. In such case you can go with first approach. In
> >> order to avoid missing results from postal code in case of small search
> >> radius and large postal code, you can reverse geocode records and store
> >> postal code with each document.
> >> If you need to handle distance from postal code precisely - distance from
> >> its border, you have to get postal code polygon, expand it by search
> >> distance and use resulting polygon to find matches.
> >>
> >> HTH,
> >> Emir
> >>
> >> On 04.03.2016 13:09, Manohar Sripada wrote:
> >>
> >>> Here's my requirement -  User enters postal code and provides the radius.
> >>> I
> >>> need to find the records with in the radius from the provided postal code.
> >>>
> >>> There are few ways I thought through after going through the "Spatial
> >>> Search" Solr wiki
> >>>
> >>> 1. As Latitude and Longitude positions are required for spatial search.
> >>> Get
> >>> Latitude Longitude position (may be using GeoCoding API) of a postal code
> >>> and use "LatLonType" field type and query accordingly. As the GeoCoding
> >>> API
> >>> returns one point and if the postal code area is too big, then I may end
> >>> up
> >>> not getting any results (apart from the records from the same postal code)
> >>> if the radius provided is small.
> >>>
> >>> 2. Get the latitude longitude points of the postal code which forms a
> >>> border (not sure yet on how to get) and build a polygon (using RPT). While
> >>> querying use this polygon and provide the distance. Can this be achieved?
> >>> Or Am I ruminating too much? :(
> >>>
> >>> Appreciate any help on this.
> >>>
> >>> Thanks
> >>>
> >>>
> >> --
> >> Monitoring * Alerting * Anomaly Detection * Centralized Log Management
> >> Solr & Elasticsearch Support * http://sematext.com/
> >>
> >>
> 
> -- 
> Monitoring * Alerting * Anomaly Detection * Centralized Log Management
> Solr & Elasticsearch Support * http://sematext.com/
> 
  

Re: Spatial Search on Postal Code

2016-03-04 Thread Emir Arnautovic

Hi Manohar,
I don't think there is such functionality in Solr - you need to do it on 
client side:
1. find some postal code polygons (you can use open street map - 
http://wiki.openstreetmap.org/wiki/Key:postal_code)

2. create zip to polygon lookup
3. create code that will expand zip code polygon by some distance (you 
can use JTS buffer api)


On query time you get zip code and distance:
1. find polygon for zip
2. expand polygon
3. send resulting polygon to Solr and use Intersects function to filter 
results


Regards,
Emir

On 04.03.2016 19:49, Manohar Sripada wrote:

Thanks Emir,

Obviously #2 approach is much better. I know its not straight forward. But,
is it really acheivable in Solr? Like building a polygon for a postal code.
If so, can you throw some light how to do?

Thanks,
Manohar

On Friday, March 4, 2016, Emir Arnautovic 
wrote:


Hi Manohar,
This depends on your requirements/usecase. If postal code is interpreted
as point than it is expected to have radius that is significantly larger
than postal code diameter. In such case you can go with first approach. In
order to avoid missing results from postal code in case of small search
radius and large postal code, you can reverse geocode records and store
postal code with each document.
If you need to handle distance from postal code precisely - distance from
its border, you have to get postal code polygon, expand it by search
distance and use resulting polygon to find matches.

HTH,
Emir

On 04.03.2016 13:09, Manohar Sripada wrote:


Here's my requirement -  User enters postal code and provides the radius.
I
need to find the records with in the radius from the provided postal code.

There are few ways I thought through after going through the "Spatial
Search" Solr wiki

1. As Latitude and Longitude positions are required for spatial search.
Get
Latitude Longitude position (may be using GeoCoding API) of a postal code
and use "LatLonType" field type and query accordingly. As the GeoCoding
API
returns one point and if the postal code area is too big, then I may end
up
not getting any results (apart from the records from the same postal code)
if the radius provided is small.

2. Get the latitude longitude points of the postal code which forms a
border (not sure yet on how to get) and build a polygon (using RPT). While
querying use this polygon and provide the distance. Can this be achieved?
Or Am I ruminating too much? :(

Appreciate any help on this.

Thanks



--
Monitoring * Alerting * Anomaly Detection * Centralized Log Management
Solr & Elasticsearch Support * http://sematext.com/




--
Monitoring * Alerting * Anomaly Detection * Centralized Log Management
Solr & Elasticsearch Support * http://sematext.com/



Re: Spatial Search on Postal Code

2016-03-04 Thread Manohar Sripada
Thank Erik,
Does this zip codes index that you created is a one-to-many
mapping from zip code to Lat/Lon points? If so, where did you get this
mapping CSV file?

Thanks,
Manohar

On Friday, March 4, 2016, Erik Hatcher  wrote:

> This is just like an implementation I recently worked on with a customer.
> It’s very much like this sort of thing ;) -
>
> <
> http://nyulangone.org/doctors?query===10019==distance=
> <
> http://nyulangone.org/doctors?query===10019==distance=
> >>
>
> It’s implemented with Solr, leveraging the Lucidworks Fusion query
> pipelines to do these steps:
>
>- =N comes in to the query pipeline
>- a sub-query is made to a separate zipcodes index (built from a CSV
> file of zipcodes and their corresponding representative lat/lon)
>- the matching lat/lon is used to build the appropriate geo-filtering
> and sorting parameters to pass on to the main collection
>
> Straightforward, clean, and effective for the needs.
>
> —
> Erik Hatcher, Senior Solutions Architect
> http://www.lucidworks.com 
>
>
>
> > On Mar 4, 2016, at 7:09 AM, Manohar Sripada  > wrote:
> >
> > Here's my requirement -  User enters postal code and provides the
> radius. I
> > need to find the records with in the radius from the provided postal
> code.
> >
> > There are few ways I thought through after going through the "Spatial
> > Search" Solr wiki
> >
> > 1. As Latitude and Longitude positions are required for spatial search.
> Get
> > Latitude Longitude position (may be using GeoCoding API) of a postal code
> > and use "LatLonType" field type and query accordingly. As the GeoCoding
> API
> > returns one point and if the postal code area is too big, then I may end
> up
> > not getting any results (apart from the records from the same postal
> code)
> > if the radius provided is small.
> >
> > 2. Get the latitude longitude points of the postal code which forms a
> > border (not sure yet on how to get) and build a polygon (using RPT).
> While
> > querying use this polygon and provide the distance. Can this be achieved?
> > Or Am I ruminating too much? :(
> >
> > Appreciate any help on this.
> >
> > Thanks
>
>


Re: Spatial Search on Postal Code

2016-03-04 Thread Manohar Sripada
Thanks Emir,

Obviously #2 approach is much better. I know its not straight forward. But,
is it really acheivable in Solr? Like building a polygon for a postal code.
If so, can you throw some light how to do?

Thanks,
Manohar

On Friday, March 4, 2016, Emir Arnautovic 
wrote:

> Hi Manohar,
> This depends on your requirements/usecase. If postal code is interpreted
> as point than it is expected to have radius that is significantly larger
> than postal code diameter. In such case you can go with first approach. In
> order to avoid missing results from postal code in case of small search
> radius and large postal code, you can reverse geocode records and store
> postal code with each document.
> If you need to handle distance from postal code precisely - distance from
> its border, you have to get postal code polygon, expand it by search
> distance and use resulting polygon to find matches.
>
> HTH,
> Emir
>
> On 04.03.2016 13:09, Manohar Sripada wrote:
>
>> Here's my requirement -  User enters postal code and provides the radius.
>> I
>> need to find the records with in the radius from the provided postal code.
>>
>> There are few ways I thought through after going through the "Spatial
>> Search" Solr wiki
>>
>> 1. As Latitude and Longitude positions are required for spatial search.
>> Get
>> Latitude Longitude position (may be using GeoCoding API) of a postal code
>> and use "LatLonType" field type and query accordingly. As the GeoCoding
>> API
>> returns one point and if the postal code area is too big, then I may end
>> up
>> not getting any results (apart from the records from the same postal code)
>> if the radius provided is small.
>>
>> 2. Get the latitude longitude points of the postal code which forms a
>> border (not sure yet on how to get) and build a polygon (using RPT). While
>> querying use this polygon and provide the distance. Can this be achieved?
>> Or Am I ruminating too much? :(
>>
>> Appreciate any help on this.
>>
>> Thanks
>>
>>
> --
> Monitoring * Alerting * Anomaly Detection * Centralized Log Management
> Solr & Elasticsearch Support * http://sematext.com/
>
>


Re: Spatial Search on Postal Code

2016-03-04 Thread Erik Hatcher
This is just like an implementation I recently worked on with a customer.  It’s 
very much like this sort of thing ;) - 


>

It’s implemented with Solr, leveraging the Lucidworks Fusion query pipelines to 
do these steps:

   - =N comes in to the query pipeline
   - a sub-query is made to a separate zipcodes index (built from a CSV file of 
zipcodes and their corresponding representative lat/lon)
   - the matching lat/lon is used to build the appropriate geo-filtering and 
sorting parameters to pass on to the main collection

Straightforward, clean, and effective for the needs.

—
Erik Hatcher, Senior Solutions Architect
http://www.lucidworks.com 



> On Mar 4, 2016, at 7:09 AM, Manohar Sripada  wrote:
> 
> Here's my requirement -  User enters postal code and provides the radius. I
> need to find the records with in the radius from the provided postal code.
> 
> There are few ways I thought through after going through the "Spatial
> Search" Solr wiki
> 
> 1. As Latitude and Longitude positions are required for spatial search. Get
> Latitude Longitude position (may be using GeoCoding API) of a postal code
> and use "LatLonType" field type and query accordingly. As the GeoCoding API
> returns one point and if the postal code area is too big, then I may end up
> not getting any results (apart from the records from the same postal code)
> if the radius provided is small.
> 
> 2. Get the latitude longitude points of the postal code which forms a
> border (not sure yet on how to get) and build a polygon (using RPT). While
> querying use this polygon and provide the distance. Can this be achieved?
> Or Am I ruminating too much? :(
> 
> Appreciate any help on this.
> 
> Thanks



Re: Spatial Search on Postal Code

2016-03-04 Thread Emir Arnautovic

Hi Manohar,
This depends on your requirements/usecase. If postal code is interpreted 
as point than it is expected to have radius that is significantly larger 
than postal code diameter. In such case you can go with first approach. 
In order to avoid missing results from postal code in case of small 
search radius and large postal code, you can reverse geocode records and 
store postal code with each document.
If you need to handle distance from postal code precisely - distance 
from its border, you have to get postal code polygon, expand it by 
search distance and use resulting polygon to find matches.


HTH,
Emir

On 04.03.2016 13:09, Manohar Sripada wrote:

Here's my requirement -  User enters postal code and provides the radius. I
need to find the records with in the radius from the provided postal code.

There are few ways I thought through after going through the "Spatial
Search" Solr wiki

1. As Latitude and Longitude positions are required for spatial search. Get
Latitude Longitude position (may be using GeoCoding API) of a postal code
and use "LatLonType" field type and query accordingly. As the GeoCoding API
returns one point and if the postal code area is too big, then I may end up
not getting any results (apart from the records from the same postal code)
if the radius provided is small.

2. Get the latitude longitude points of the postal code which forms a
border (not sure yet on how to get) and build a polygon (using RPT). While
querying use this polygon and provide the distance. Can this be achieved?
Or Am I ruminating too much? :(

Appreciate any help on this.

Thanks



--
Monitoring * Alerting * Anomaly Detection * Centralized Log Management
Solr & Elasticsearch Support * http://sematext.com/



Re: Spatial Search killing Solr process

2015-03-19 Thread david.w.smi...@gmail.com
Hi Henrique,

Please see the Solr reference guide instead of the “community wiki” you
referenced:
https://cwiki.apache.org/confluence/display/solr/Spatial+Search  (you can
download one for 4.10; the online link is always for the latest).

For spatial filtering, *especially* at-scale, you really should be using
RPT instead of LatLonType.  It requires no memory for filtering.  RPT is
poor at distance sorting but you didn’t mention that.

~ David Smiley
Freelance Apache Lucene/Solr Search Consultant/Developer
http://www.linkedin.com/in/davidwsmiley

On Thu, Mar 19, 2015 at 4:30 PM, Henrique O. Santos hensan...@gmail.com
wrote:

 Hello all,

 I have a Solr 4.10.3 collection with ~55 million documents (index size
 about 6GB) with a LatLonType field and a dynamic field for storing the
 coordinates, like stated here
 https://wiki.apache.org/solr/SpatialSearch#Schema_Configuration 
 https://wiki.apache.org/solr/SpatialSearch#Schema_Configuration

 I am trying to use geofilt to filter query results, but it is triggering
 the OOM Killer script”, killing Solr process, after some seconds of
 processing. Other queries run fine. I have a machine with 64GB RAM, but
 just about 10GB free. Is that enough to handle a query like this?

 Thanks,
 Henrique.


Re: Spatial Search killing Solr process

2015-03-19 Thread Henrique O. Santos
Thanks, David. I’m looking at it now.

 On Mar 19, 2015, at 4:51 PM, david.w.smi...@gmail.com wrote:
 
 Hi Henrique,
 
 Please see the Solr reference guide instead of the “community wiki” you
 referenced:
 https://cwiki.apache.org/confluence/display/solr/Spatial+Search  (you can
 download one for 4.10; the online link is always for the latest).
 
 For spatial filtering, *especially* at-scale, you really should be using
 RPT instead of LatLonType.  It requires no memory for filtering.  RPT is
 poor at distance sorting but you didn’t mention that.
 
 ~ David Smiley
 Freelance Apache Lucene/Solr Search Consultant/Developer
 http://www.linkedin.com/in/davidwsmiley
 
 On Thu, Mar 19, 2015 at 4:30 PM, Henrique O. Santos hensan...@gmail.com
 wrote:
 
 Hello all,
 
 I have a Solr 4.10.3 collection with ~55 million documents (index size
 about 6GB) with a LatLonType field and a dynamic field for storing the
 coordinates, like stated here
 https://wiki.apache.org/solr/SpatialSearch#Schema_Configuration 
 https://wiki.apache.org/solr/SpatialSearch#Schema_Configuration
 
 I am trying to use geofilt to filter query results, but it is triggering
 the OOM Killer script”, killing Solr process, after some seconds of
 processing. Other queries run fine. I have a machine with 64GB RAM, but
 just about 10GB free. Is that enough to handle a query like this?
 
 Thanks,
 Henrique.



Re: spatial search: find result in bbox OR first result outside bbox

2014-07-25 Thread elisabeth benoit
Thanks a lot for your answer David!

I'll check that out.

Elisabeth


2014-07-24 20:28 GMT+02:00 david.w.smi...@gmail.com 
david.w.smi...@gmail.com:

 Hi Elisabeth,

 Sorry for not responding sooner; I forgot.

 You’re in need of some spatial nearest-neighbor code I wrote but it isn’t
 open-sourced yet.  It works on the RPT grid.

 Any way, you should consider doing this in two searches: the first query
 tries the bbox provided, and if that returns nothing then issue a second
 for the closest within the a 1000km distance.  The first query is
 straight-forward as documented.  The second would be close to what you gave
 in your example but sort by distance and return rows=1.  It will *not*
 compute the distance to every document, just those within the 1000km radius
 plus some grid internal grid squares *if* you use spatial RPT
 (“location_rpt” in the example schema).  But use LatLonType for optimal
 sorting performance, not RPT.

 With respect to doing this in one search vs two, that would involve writing
 a custom request handler.  I have a patch to make this easier:
 https://issues.apache.org/jira/browse/SOLR-5005.  If in your case there
 are
 absolutely no other filters and it’s not a distributed search (no
 sharding), then you could approach this with a custom query parser that
 generates and executes one query to know if it should return that query or
 return the fallback.

 Please let me know how this goes.

 ~ David Smiley
 Freelance Apache Lucene/Solr Search Consultant/Developer
 http://www.linkedin.com/in/davidwsmiley


 On Tue, Jul 22, 2014 at 3:12 AM, elisabeth benoit 
 elisaelisael...@gmail.com
  wrote:

  Hello,
 
  I am using solr 4.2.1. I have the following use case.
 
  I should find results inside bbox OR if there is none, first result
 outside
  bbox within a 1000 km distance. I was wondering what is the best way to
  proceed.
 
  I was considering doing a geofilt search from the center of my bounding
 box
  and post filtering results.
 
  fq={!geofilt sfield=store}pt=45.15,-93.85d=1000
 
  From a performance point of view I don't think it's a good solution
 though,
  since solr will have to calculate every document distance, then sort.
 
  I was wondering if there was another way to do this and avoid sending
 more
  than one request to solr.
 
  Thanks,
  Elisabeth
 



Re: spatial search: find result in bbox OR first result outside bbox

2014-07-24 Thread david.w.smi...@gmail.com
Hi Elisabeth,

Sorry for not responding sooner; I forgot.

You’re in need of some spatial nearest-neighbor code I wrote but it isn’t
open-sourced yet.  It works on the RPT grid.

Any way, you should consider doing this in two searches: the first query
tries the bbox provided, and if that returns nothing then issue a second
for the closest within the a 1000km distance.  The first query is
straight-forward as documented.  The second would be close to what you gave
in your example but sort by distance and return rows=1.  It will *not*
compute the distance to every document, just those within the 1000km radius
plus some grid internal grid squares *if* you use spatial RPT
(“location_rpt” in the example schema).  But use LatLonType for optimal
sorting performance, not RPT.

With respect to doing this in one search vs two, that would involve writing
a custom request handler.  I have a patch to make this easier:
https://issues.apache.org/jira/browse/SOLR-5005.  If in your case there are
absolutely no other filters and it’s not a distributed search (no
sharding), then you could approach this with a custom query parser that
generates and executes one query to know if it should return that query or
return the fallback.

Please let me know how this goes.

~ David Smiley
Freelance Apache Lucene/Solr Search Consultant/Developer
http://www.linkedin.com/in/davidwsmiley


On Tue, Jul 22, 2014 at 3:12 AM, elisabeth benoit elisaelisael...@gmail.com
 wrote:

 Hello,

 I am using solr 4.2.1. I have the following use case.

 I should find results inside bbox OR if there is none, first result outside
 bbox within a 1000 km distance. I was wondering what is the best way to
 proceed.

 I was considering doing a geofilt search from the center of my bounding box
 and post filtering results.

 fq={!geofilt sfield=store}pt=45.15,-93.85d=1000

 From a performance point of view I don't think it's a good solution though,
 since solr will have to calculate every document distance, then sort.

 I was wondering if there was another way to do this and avoid sending more
 than one request to solr.

 Thanks,
 Elisabeth



Re: spatial search, geofilt does not work

2013-08-20 Thread Mingfeng Yang
Oh, man.  I have been trying to figure out the problem for half day.
 Probably Solr could use some error msg if the query format is invalid.

But, THANKS! David, you probably saved me another half day.

Ming-



On Mon, Aug 19, 2013 at 10:20 PM, David Smiley (@MITRE.org) 
dsmi...@mitre.org wrote:

 Thank goodness for Solr's feature of echo'ing params back in the response
 as
 it helps diagnose problems like this.  In your case, the filter query that
 Solr is seeing isn't what you (seemed) to have given on the command line:
 fq:!geofilt sfield=author_geo
 Clearly wrong.  Try escaping the braces with URL percent escapes, etc.

 ~ David


 Mingfeng Yang wrote
  My solr index has a field called author_geo which contains the author's
  location, and when I am trying to get all docs whose author are within 10
  km of 35.0,35.0 using the following query.
 
  curl '
 
 http://localhost/solr/select?q=*:*fq={!geofilt%20sfield=author_geo}pt=35.0,35.0d=10wt=jsonindent=truefl=author_geo
  '
 
  I got one match document which actually has no value of author_geo.
 
  {
responseHeader:{
  status:0,
  QTime:7,
  params:{
d:10,
fl:author_geo,
indent:true,
q:*:*,
pt:35.0,35.0,
wt:json,
fq:!geofilt sfield=author_geo}},
response:{numFound:1,start:0,maxScore:1.0,docs:[
{}]
}}
 
 
  But if I run the following query to do a sorting, it shows clearly that
  there are at least 6 docs which are within 10km of 35.0,35.0.
 
  curl '
 
 http://localhost/solr/select?q=*:*sort=geodist(author_geo,35,35)+ascwt=jsonindent=truefl=author_geo,geodist(author_geo,35,35)fq=author_geo
  :\[0,0%20TO%20360,360\]'
 
  {
responseHeader:{
  status:0,
  QTime:10,
  params:{
fl:author_geo,geodist(author_geo,35,35),
sort:geodist(author_geo,35,35) asc,
indent:true,
q:*:*,
wt:json,
fq:author_geo:[0,0 TO 360,360]}},
response:{numFound:78133,start:0,docs:[
{
  author_geo:34.991199,34.991199,
  geodist(author_geo,35,35):1.2650756688780775},
{
  author_geo:34.991199,34.991199,
  geodist(author_geo,35,35):1.2650756688780775},
{
  author_geo:34.991199,34.991199,
  geodist(author_geo,35,35):1.2650756688780775},
{
  author_geo:35.032242,35.032242,
  geodist(author_geo,35,35):4.634071252404282},
{
  author_geo:35.04644,35.04644,
  geodist(author_geo,35,35):6.674485609316976},
{
  author_geo:35.060379,35.060379,
  geodist(author_geo,35,35):8.67754019129343},
{
  author_geo:34.924019,34.924019,
  geodist(author_geo,35,35):10.923479728441448},
{
  author_geo:34.89296,34.89296,
  geodist(author_geo,35,35):15.389876355902395},
{
  author_geo:34.89296,34.89296,
  geodist(author_geo,35,35):15.389876355902395},
{
  author_geo:35.109669,35.109669,
  geodist(author_geo,35,35):15.759483283896515}]
}}
 
  Can anyone tell me if anything is wrong here?  I am using Solr 4.4.
 
  Thanks,
  Ming-





 -
  Author:
 http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
 --
 View this message in context:
 http://lucene.472066.n3.nabble.com/spatial-search-geofilt-does-not-work-tp4085551p4085590.html
 Sent from the Solr - User mailing list archive at Nabble.com.



Re: spatial search, geofilt does not work

2013-08-20 Thread David Smiley (@MITRE.org)
Technically, the query was valid in that it parsed.  If it didn't parse then
you'd get an error.  If the notion of a default field didn't exist, and I
wish it didn't, then you would most certainly have gotten an error.  Perhaps
you are using the defaultSearchField feature in the schema; please don't --
your conundrum here shows how it can be a problem.  Or perhaps you used 'df'
as a request parameter -- again, same issue.  When I (rarely) use 'df', I
use it as a local-param.

~ David


Mingfeng Yang wrote
 Oh, man.  I have been trying to figure out the problem for half day.
  Probably Solr could use some error msg if the query format is invalid.
 
 But, THANKS! David, you probably saved me another half day.
 
 Ming-
 
 
 
 On Mon, Aug 19, 2013 at 10:20 PM, David Smiley (@MITRE.org) 

 DSMILEY@

 wrote:
 
 Thank goodness for Solr's feature of echo'ing params back in the response
 as
 it helps diagnose problems like this.  In your case, the filter query
 that
 Solr is seeing isn't what you (seemed) to have given on the command line:
 fq:!geofilt sfield=author_geo
 Clearly wrong.  Try escaping the braces with URL percent escapes, etc.

 ~ David


 Mingfeng Yang wrote
  My solr index has a field called author_geo which contains the
 author's
  location, and when I am trying to get all docs whose author are within
 10
  km of 35.0,35.0 using the following query.
 
  curl '
 
 http://localhost/solr/select?q=*:*fq={!geofilt%20sfield=author_geo}pt=35.0,35.0d=10wt=jsonindent=truefl=author_geo
  '
 
  I got one match document which actually has no value of author_geo.
 
  {
responseHeader:{
  status:0,
  QTime:7,
  params:{
d:10,
fl:author_geo,
indent:true,
q:*:*,
pt:35.0,35.0,
wt:json,
fq:!geofilt sfield=author_geo}},
response:{numFound:1,start:0,maxScore:1.0,docs:[
{}]
}}
 
 
  But if I run the following query to do a sorting, it shows clearly that
  there are at least 6 docs which are within 10km of 35.0,35.0.
 
  curl '
 
 http://localhost/solr/select?q=*:*sort=geodist(author_geo,35,35)+ascwt=jsonindent=truefl=author_geo,geodist(author_geo,35,35)fq=author_geo
  :\[0,0%20TO%20360,360\]'
 
  {
responseHeader:{
  status:0,
  QTime:10,
  params:{
fl:author_geo,geodist(author_geo,35,35),
sort:geodist(author_geo,35,35) asc,
indent:true,
q:*:*,
wt:json,
fq:author_geo:[0,0 TO 360,360]}},
response:{numFound:78133,start:0,docs:[
{
  author_geo:34.991199,34.991199,
  geodist(author_geo,35,35):1.2650756688780775},
{
  author_geo:34.991199,34.991199,
  geodist(author_geo,35,35):1.2650756688780775},
{
  author_geo:34.991199,34.991199,
  geodist(author_geo,35,35):1.2650756688780775},
{
  author_geo:35.032242,35.032242,
  geodist(author_geo,35,35):4.634071252404282},
{
  author_geo:35.04644,35.04644,
  geodist(author_geo,35,35):6.674485609316976},
{
  author_geo:35.060379,35.060379,
  geodist(author_geo,35,35):8.67754019129343},
{
  author_geo:34.924019,34.924019,
  geodist(author_geo,35,35):10.923479728441448},
{
  author_geo:34.89296,34.89296,
  geodist(author_geo,35,35):15.389876355902395},
{
  author_geo:34.89296,34.89296,
  geodist(author_geo,35,35):15.389876355902395},
{
  author_geo:35.109669,35.109669,
  geodist(author_geo,35,35):15.759483283896515}]
}}
 
  Can anyone tell me if anything is wrong here?  I am using Solr 4.4.
 
  Thanks,
  Ming-





 -
  Author:
 http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
 --
 View this message in context:
 http://lucene.472066.n3.nabble.com/spatial-search-geofilt-does-not-work-tp4085551p4085590.html
 Sent from the Solr - User mailing list archive at Nabble.com.






-
 Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
--
View this message in context: 
http://lucene.472066.n3.nabble.com/spatial-search-geofilt-does-not-work-tp4085551p4085781.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: spatial search, geofilt does not work

2013-08-19 Thread Mingfeng Yang
BTW: my schema.xml contains the following related lines.

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


On Mon, Aug 19, 2013 at 2:02 PM, Mingfeng Yang mfy...@wisewindow.comwrote:

 My solr index has a field called author_geo which contains the author's
 location, and when I am trying to get all docs whose author are within 10
 km of 35.0,35.0 using the following query.

 curl '
 http://localhost/solr/select?q=*:*fq={!geofilt%20sfield=author_geo}pt=35.0,35.0d=10wt=jsonindent=truefl=author_geohttp://localhost/solr/select?q=*:*fq=%7B!geofilt%20sfield=author_geo%7Dpt=35.0,35.0d=10wt=jsonindent=truefl=author_geo
 '

 I got one match document which actually has no value of author_geo.

 {
   responseHeader:{
 status:0,
 QTime:7,
 params:{
   d:10,
   fl:author_geo,
   indent:true,
   q:*:*,
   pt:35.0,35.0,
   wt:json,
   fq:!geofilt sfield=author_geo}},
   response:{numFound:1,start:0,maxScore:1.0,docs:[
   {}]
   }}


 But if I run the following query to do a sorting, it shows clearly that
 there are at least 6 docs which are within 10km of 35.0,35.0.

 curl '
 http://localhost/solr/select?q=*:*sort=geodist(author_geo,35,35)+ascwt=jsonindent=truefl=author_geo,geodist(author_geo,35,35)fq=author_geo
 :\[0,0%20TO%20360,360\]'

 {
   responseHeader:{
 status:0,
 QTime:10,
 params:{
   fl:author_geo,geodist(author_geo,35,35),
   sort:geodist(author_geo,35,35) asc,
   indent:true,
   q:*:*,
   wt:json,
   fq:author_geo:[0,0 TO 360,360]}},
   response:{numFound:78133,start:0,docs:[
   {
 author_geo:34.991199,34.991199,
 geodist(author_geo,35,35):1.2650756688780775},
   {
 author_geo:34.991199,34.991199,
 geodist(author_geo,35,35):1.2650756688780775},
   {
 author_geo:34.991199,34.991199,
 geodist(author_geo,35,35):1.2650756688780775},
   {
 author_geo:35.032242,35.032242,
 geodist(author_geo,35,35):4.634071252404282},
   {
 author_geo:35.04644,35.04644,
 geodist(author_geo,35,35):6.674485609316976},
   {
 author_geo:35.060379,35.060379,
 geodist(author_geo,35,35):8.67754019129343},
   {
 author_geo:34.924019,34.924019,
 geodist(author_geo,35,35):10.923479728441448},
   {
 author_geo:34.89296,34.89296,
 geodist(author_geo,35,35):15.389876355902395},
   {
 author_geo:34.89296,34.89296,
 geodist(author_geo,35,35):15.389876355902395},
   {
 author_geo:35.109669,35.109669,
 geodist(author_geo,35,35):15.759483283896515}]
   }}

 Can anyone tell me if anything is wrong here?  I am using Solr 4.4.

 Thanks,
 Ming-




Re: spatial search, geofilt does not work

2013-08-19 Thread David Smiley (@MITRE.org)
Thank goodness for Solr's feature of echo'ing params back in the response as
it helps diagnose problems like this.  In your case, the filter query that
Solr is seeing isn't what you (seemed) to have given on the command line:
fq:!geofilt sfield=author_geo
Clearly wrong.  Try escaping the braces with URL percent escapes, etc.

~ David


Mingfeng Yang wrote
 My solr index has a field called author_geo which contains the author's
 location, and when I am trying to get all docs whose author are within 10
 km of 35.0,35.0 using the following query.
 
 curl '
 http://localhost/solr/select?q=*:*fq={!geofilt%20sfield=author_geo}pt=35.0,35.0d=10wt=jsonindent=truefl=author_geo
 '
 
 I got one match document which actually has no value of author_geo.
 
 {
   responseHeader:{
 status:0,
 QTime:7,
 params:{
   d:10,
   fl:author_geo,
   indent:true,
   q:*:*,
   pt:35.0,35.0,
   wt:json,
   fq:!geofilt sfield=author_geo}},
   response:{numFound:1,start:0,maxScore:1.0,docs:[
   {}]
   }}
 
 
 But if I run the following query to do a sorting, it shows clearly that
 there are at least 6 docs which are within 10km of 35.0,35.0.
 
 curl '
 http://localhost/solr/select?q=*:*sort=geodist(author_geo,35,35)+ascwt=jsonindent=truefl=author_geo,geodist(author_geo,35,35)fq=author_geo
 :\[0,0%20TO%20360,360\]'
 
 {
   responseHeader:{
 status:0,
 QTime:10,
 params:{
   fl:author_geo,geodist(author_geo,35,35),
   sort:geodist(author_geo,35,35) asc,
   indent:true,
   q:*:*,
   wt:json,
   fq:author_geo:[0,0 TO 360,360]}},
   response:{numFound:78133,start:0,docs:[
   {
 author_geo:34.991199,34.991199,
 geodist(author_geo,35,35):1.2650756688780775},
   {
 author_geo:34.991199,34.991199,
 geodist(author_geo,35,35):1.2650756688780775},
   {
 author_geo:34.991199,34.991199,
 geodist(author_geo,35,35):1.2650756688780775},
   {
 author_geo:35.032242,35.032242,
 geodist(author_geo,35,35):4.634071252404282},
   {
 author_geo:35.04644,35.04644,
 geodist(author_geo,35,35):6.674485609316976},
   {
 author_geo:35.060379,35.060379,
 geodist(author_geo,35,35):8.67754019129343},
   {
 author_geo:34.924019,34.924019,
 geodist(author_geo,35,35):10.923479728441448},
   {
 author_geo:34.89296,34.89296,
 geodist(author_geo,35,35):15.389876355902395},
   {
 author_geo:34.89296,34.89296,
 geodist(author_geo,35,35):15.389876355902395},
   {
 author_geo:35.109669,35.109669,
 geodist(author_geo,35,35):15.759483283896515}]
   }}
 
 Can anyone tell me if anything is wrong here?  I am using Solr 4.4.
 
 Thanks,
 Ming-





-
 Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
--
View this message in context: 
http://lucene.472066.n3.nabble.com/spatial-search-geofilt-does-not-work-tp4085551p4085590.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Spatial search question

2013-04-12 Thread Lance Norskog

Outer distance AND NOT inner distance?

On 04/12/2013 09:02 AM, kfdroid wrote:

We currently do a radius search from a given Lat/Long point and it works
great. I have a new requirement to do a search on a larger radius from the
same point, but not include the smaller radius.  Kind of a donut (torus)
shaped search.

How would I do this (Solr 4)?  Search where radius is between 20km and 40km
for example?
Thanks,
Ken



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




Re: Spatial search question

2013-04-12 Thread David Smiley (@MITRE.org)
Yup, Lance is right.  But it won't always work if you have multi-valued data
since it wouldn't match a document that had a point both in the ring and the
hole.

Another approach that internally works faster and addresses the multi-value
case is to implement a custom Spatial4j Shape.  In this case, you could
create a special aggregate Shape that basically accepts one shape and
excludes the other, in its custom relate() method.  It's like a subtracting
shape.  This is generically useful and on my list of things to do but I
haven't had the need.  The other step would be parsing it somehow, so you
might do that by extending the existing spatial 4 field type.

~ David


Lance Norskog-2 wrote
 Outer distance AND NOT inner distance?
 
 On 04/12/2013 09:02 AM, kfdroid wrote:
 We currently do a radius search from a given Lat/Long point and it works
 great. I have a new requirement to do a search on a larger radius from
 the
 same point, but not include the smaller radius.  Kind of a donut (torus)
 shaped search.

 How would I do this (Solr 4)?  Search where radius is between 20km and
 40km
 for example?
 Thanks,
 Ken



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





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


Re: Spatial Search with document score as distance between two points

2013-03-21 Thread Chris Hostetter

: q={!func}geodist()sfield=latlngpt=28.635308,77.22496sort=score+asc
...
: Problem : For those documents which doesn't have latlng field, value is 
coming exceptionally large '8763.191'.

I'm pretty sure you're seeing the function assume a default lat,lon of 
0,0 for docs thta you haven't given a position.

If you don't have a location on every doc, you're probably going to want 
to use a filter query to exclude docs that have no location -- i'm not 
sure off the top of my head how to do that.

: How can I limit this maximum distance(i.e score) as 25?

apply another fq that filters by distance, either using bbox or geofilt...

http://wiki.apache.org/solr/SpatialSearch#bbox_-_Bounding-box_filter
http://wiki.apache.org/solr/SpatialSearch#geofilt_-_The_distance_filter

...but you'll still want to find a way ot filter out docs with no latlon 
values, otherwise you're going to get false positives if your input point 
ever happens to be within 25km of 0,0


-Hoss


Re: Spatial Search response time complexity

2012-10-15 Thread Smiley, David W.
Hi TJ.

If you use a circle query shape, it's O(N), plus it puts all the points in 
memory.  If you use a rectangle via bbox then I'm not sure but its fast enough 
that I wouldn't worry about it.  If my understanding is correct on Lucene 
TrieRange fields, it's O(Log(N)).  If you want fast filtering no matter what 
the query shape is, then I suggest Solr 4.0 SpatialRecursivePrefixTreeFieldType 
  (location_rpt in the example schema)

~ David Smiley

On Oct 9, 2012, at 5:00 PM, TJ Tong wrote:

 Hi all,
 
 Does anyone know the Solr (lucene)spatial search time complexity, such as
 geofilt on LatLonType fields? Is it logN? 
 
 Thanks!
 TJ
 
 
 
 --
 View this message in context: 
 http://lucene.472066.n3.nabble.com/Spatial-Search-response-time-complexity-tp4012801.html
 Sent from the Solr - User mailing list archive at Nabble.com.



Re: Spatial Search and faceting

2012-02-16 Thread Eric Grobler
Hi William,

Thanks for the feedback.

I will try the group query and see how the performance with 2 queries is.

Best Regards
Ericz

On Thu, Feb 16, 2012 at 4:06 AM, William Bell billnb...@gmail.com wrote:

 One way to do it is to group by city and then sort=geodist() asc

 select?group=truegroup.field=citysort=geodist() descrows=10fl=city

 It might require 2 calls to SOLR to get it the way you want.

 On Wed, Feb 15, 2012 at 5:51 PM, Eric Grobler impalah...@googlemail.com
 wrote:
  Hi Solr community,
 
  I am doing a spatial search and then do a facet by city.
  Is it possible to then sort the faceted cities by distance?
 
  We would like to display the hits per city, but sort them by distance.
 
  Thanks  Regards
  Ericz
 
  q=iphone
  fq={!bbox}
  sfield=geopoint
  pt=49.594857,8.468614
  d=50
  fl=id,description,city,geopoint
 
  facet=true
  facet.field=city
  f.city.facet.limit=10
  f.city.facet.sort=count //geodist() asc



 --
 Bill Bell
 billnb...@gmail.com
 cell 720-256-8076



Re: Spatial Search and faceting

2012-02-15 Thread William Bell
One way to do it is to group by city and then sort=geodist() asc

select?group=truegroup.field=citysort=geodist() descrows=10fl=city

It might require 2 calls to SOLR to get it the way you want.

On Wed, Feb 15, 2012 at 5:51 PM, Eric Grobler impalah...@googlemail.com wrote:
 Hi Solr community,

 I am doing a spatial search and then do a facet by city.
 Is it possible to then sort the faceted cities by distance?

 We would like to display the hits per city, but sort them by distance.

 Thanks  Regards
 Ericz

 q=iphone
 fq={!bbox}
 sfield=geopoint
 pt=49.594857,8.468614
 d=50
 fl=id,description,city,geopoint

 facet=true
 facet.field=city
 f.city.facet.limit=10
 f.city.facet.sort=count //geodist() asc



-- 
Bill Bell
billnb...@gmail.com
cell 720-256-8076


Re: spatial search or null

2011-12-01 Thread Rob Brown
Recently had this myself...

http://wiki.apache.org/solr/SpatialSearch#How_to_combine_with_a_sub-query_to_expand_results



-- 

IntelCompute
Web Design and Online Marketing

http://www.intelcompute.com


-Original Message-
From: dan whelan d...@adicio.com
Reply-to: solr-user@lucene.apache.org
To: solr-user@lucene.apache.org
Subject: spatial search or null
Date: Thu, 01 Dec 2011 10:22:38 -0800

Hi,

how would I go about constructing a solr 3.2 spatial query that would 
return documents that are in a specified radius OR documents that have 
no location information.

The query would have a similar result as this:   q=City:San Diego OR 
-City:['' TO *]


Thanks



Re: Spatial Search problems

2011-08-25 Thread Javier Heras
Thanx David,

Just one more question. Am I able to do spatial search with solr1.4? And
with lucene 2.9? What's your recomendation?

Javier

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


Re: Spatial Search problems

2011-08-25 Thread Smiley, David W.
Um, You might try googling LocalSolr or LocalLucene -- dead projects but you 
insist on using an old Solr/Lucene.

Of course if all you need is a bounding box filter than a pair of lat  lon 
range queries is sufficient.

~ David Smiley

On Aug 25, 2011, at 4:01 AM, Javier Heras wrote:

 Thanx David,
 
 Just one more question. Am I able to do spatial search with solr1.4? And
 with lucene 2.9? What's your recomendation?
 
 Javier
 
 --
 View this message in context: 
 http://lucene.472066.n3.nabble.com/Spatial-Search-problems-tp3277945p3283285.html
 Sent from the Solr - User mailing list archive at Nabble.com.



Re: Spatial Search problems

2011-08-24 Thread Javier Heras
Hi David,

the thing is that all indexed points are in spain, so distances should
always be lower than 1300 Kms. And yes, I'm using solr tutorial scheme.xml,
for which tutorial indexes work fine. When I change to my index, it only
works when distances are over 4510Kms. The query I run is:

http://localhost:8983/solr/select?fl=*,scoreq=*:*fq={!geofilt}sfield=storept=40.41669,-3.700346d=4510

And some of my indexed points are:

38.99765,-1.86007

This point is supossed to be in between 250kms more or less.

One thing: which is the way the coordinates field should be indexed?

Thanks

Javier

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


Re: Spatial Search problems

2011-08-24 Thread Javier Heras
And one more thing... should I create the index with the same version of solr
that I use to open index for reading??? I create my index with lucene 2.9,
and my solr version where Im trying spatial search is 3.3

Thank you very much David

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


Re: Spatial Search problems

2011-08-24 Thread Smiley, David W.
Well that's your problem :-P  You need to be using the same version of Lucene 
for reading  writing.  Create your index with Lucene 3.3.

FYI I tried indexing the point you said you had trouble with, and with a 300km 
radius, and it found it.

On Aug 24, 2011, at 4:39 AM, Javier Heras wrote:

 And one more thing... should I create the index with the same version of solr
 that I use to open index for reading??? I create my index with lucene 2.9,
 and my solr version where Im trying spatial search is 3.3
 
 Thank you very much David
 
 --
 View this message in context: 
 http://lucene.472066.n3.nabble.com/Spatial-Search-problems-tp3277945p3280389.html
 Sent from the Solr - User mailing list archive at Nabble.com.



Re: Spatial Search problems

2011-08-23 Thread Smiley, David W.
Could you reproduce a very simple example of this? For example if there is a 
particular indexed point in your data that should be returned from your query 
(a query smaller than d=4k10), then reproduce that bug in the Solr example app 
by supplying a dummy document with this point and running your query.  Also, be 
sure you are using the correct field type (LatLonType).

~ David Smiley

On Aug 23, 2011, at 9:12 AM, Javier Heras wrote:

 Hi all,
 
 I'm new at solr. I've downloaded solr 3.3, and having tested solr querys for
 spatial search with examples that come in the tutorial. Everything ok. But
 when I substitute the tutorial index with my index, spatial search doesn't
 work until parameter d is greater than 4510 (km?)
 
 Any idea what's going on?
 
 Thanks
 
 Javier
 
 --
 View this message in context: 
 http://lucene.472066.n3.nabble.com/Spatial-Search-problems-tp3277945p3277945.html
 Sent from the Solr - User mailing list archive at Nabble.com.



Re: Spatial Search and Highlighting

2011-08-01 Thread Smiley, David W.
Can you demonstrate the bug against the example data?  If so, provide the URL 
please.
~ David

On Aug 1, 2011, at 4:00 PM, Ralf Musick wrote:

 Hi,
 
 I combined a spatial distance search with a fulltext search as described 
 in 
 http://wiki.apache.org/solr/SpatialSearch#geodist_-_The_distance_function .
 I'm using solr 3.3 and that works fine.
 BUT, I want to use highlighting of fulltext query words but that does 
 not work.
 
 Before solr 3.3, I used solr 1.4 with Spatial Search plugin from Jteam 
 and that works fine also with highlighting.
 
 After refactoring because of API change I miss the highlighting feature.
 
 Is that a known issue? Or what is my mistake/ I have to do?
 
 Example Query:
 INFO: [organisations] webapp=/solr path=/select 
 params={hl.fragsize=250sort=score+ascsfield=store_lat_lonjson.nl=maphl.fl=name,category_namewt=jsonhl=onrows=10fl=id,name,street,city,score,lat,lngstart=0q={!func}geodist()pt=52.5600917,13.4222482fq=((country_name:+(automatisierung))^8+OR+(category_name:+(automatisierung))^10+OR+(sub_category_name:+(automatisierung))^10}
  
 hits=37 status=0 QTime=7
 
 
 Thanks is Advance,
  Ralf



Re: Spatial Search and Highlighting

2011-08-01 Thread Ralf Musick

Hi David,

an example is:
http://localhost:8983/solr/browse?indent=onhl=onhl.fl=name,manusort=score+ascsfield=storejson.nl=mapwt=jsonrows=10start=0q={!func}geodist%28%29pt=45.17614%2C-93.87341fq=%28name%20:+%28canon%29%29^8

I have to say I need the calculated distance as a return field (score) 
in the result list.
The pseudo field solution described here 
http://wiki.apache.org/solr/SpatialSearch#Returning_the_distance did not 
word, so I created the query above.


Thanks,
 Ralf


Am 01.08.2011 22:21, schrieb Smiley, David W.:

Can you demonstrate the bug against the example data?  If so, provide the URL 
please.
~ David

On Aug 1, 2011, at 4:00 PM, Ralf Musick wrote:


Hi,

I combined a spatial distance search with a fulltext search as described
in
http://wiki.apache.org/solr/SpatialSearch#geodist_-_The_distance_function .
I'm using solr 3.3 and that works fine.
BUT, I want to use highlighting of fulltext query words but that does
not work.

Before solr 3.3, I used solr 1.4 with Spatial Search plugin from Jteam
and that works fine also with highlighting.

After refactoring because of API change I miss the highlighting feature.

Is that a known issue? Or what is my mistake/ I have to do?

Example Query:
INFO: [organisations] webapp=/solr path=/select
params={hl.fragsize=250sort=score+ascsfield=store_lat_lonjson.nl=maphl.fl=name,category_namewt=jsonhl=onrows=10fl=id,name,street,city,score,lat,lngstart=0q={!func}geodist()pt=52.5600917,13.4222482fq=((country_name:+(automatisierung))^8+OR+(category_name:+(automatisierung))^10+OR+(sub_category_name:+(automatisierung))^10}
hits=37 status=0 QTime=7


Thanks is Advance,
  Ralf






Re: Spatial Search and Highlighting

2011-08-01 Thread Smiley, David W.
Ralf,

Highlighting (and search relevancy -- the score) is performed on the user query 
which must be in the q parameter.  In your case, I see you placed your 
geospatial query there and you put your user query into a filter query fq.  
You have them reversed.  

You stated that the returning the distance information on the wiki didn't 
work -- that's because those instructions are for Solr 4.0 (not released yet) 
-- notice the warning symbol. I recommend that you calculate the distance 
yourself since Solr 4.0 isn't out yet. There is plenty of information on the 
web on how to calculate the distance between two lat-lon points using the 
Haversine algorithm.

~ David

On Aug 1, 2011, at 5:00 PM, Ralf Musick wrote:

 Hi David,
 
 an example is:
 http://localhost:8983/solr/browse?indent=onhl=onhl.fl=name,manusort=score+ascsfield=storejson.nl=mapwt=jsonrows=10start=0q={!func}geodist%28%29pt=45.17614%2C-93.87341fq=%28name%20:+%28canon%29%29^8
 
 I have to say I need the calculated distance as a return field (score) 
 in the result list.
 The pseudo field solution described here 
 http://wiki.apache.org/solr/SpatialSearch#Returning_the_distance did not 
 word, so I created the query above.
 
 Thanks,
  Ralf
 
 
 Am 01.08.2011 22:21, schrieb Smiley, David W.:
 Can you demonstrate the bug against the example data?  If so, provide the 
 URL please.
 ~ David
 
 On Aug 1, 2011, at 4:00 PM, Ralf Musick wrote:
 
 Hi,
 
 I combined a spatial distance search with a fulltext search as described
 in
 http://wiki.apache.org/solr/SpatialSearch#geodist_-_The_distance_function .
 I'm using solr 3.3 and that works fine.
 BUT, I want to use highlighting of fulltext query words but that does
 not work.
 
 Before solr 3.3, I used solr 1.4 with Spatial Search plugin from Jteam
 and that works fine also with highlighting.
 
 After refactoring because of API change I miss the highlighting feature.
 
 Is that a known issue? Or what is my mistake/ I have to do?
 
 Example Query:
 INFO: [organisations] webapp=/solr path=/select
 params={hl.fragsize=250sort=score+ascsfield=store_lat_lonjson.nl=maphl.fl=name,category_namewt=jsonhl=onrows=10fl=id,name,street,city,score,lat,lngstart=0q={!func}geodist()pt=52.5600917,13.4222482fq=((country_name:+(automatisierung))^8+OR+(category_name:+(automatisierung))^10+OR+(sub_category_name:+(automatisierung))^10}
 hits=37 status=0 QTime=7
 
 
 Thanks is Advance,
  Ralf
 
 



Re: Spatial Search and Highlighting

2011-08-01 Thread Ralf Musick

Hi David,

So that As a temporary workaround for older Solr versions, it's 
possible to obtain distances by using geodist or geofilt as the only 
scoring part of the main query

and Highlighting do not fit together, right?

Ok, than I have to calculate the distance by my own.

Thank you very much for your given information!!

Best regards,
 Ralf



Am 01.08.2011 23:30, schrieb Smiley, David W.:

Ralf,

Highlighting (and search relevancy -- the score) is performed on the user query which must be in 
the q parameter.  In your case, I see you placed your geospatial query there and you 
put your user query into a filter query fq.  You have them reversed.

You stated that the returning the distance information on the wiki didn't 
work -- that's because those instructions are for Solr 4.0 (not released yet) -- notice 
the warning symbol. I recommend that you calculate the distance yourself since Solr 4.0 
isn't out yet. There is plenty of information on the web on how to calculate the distance 
between two lat-lon points using the Haversine algorithm.

~ David

On Aug 1, 2011, at 5:00 PM, Ralf Musick wrote:


Hi David,

an example is:
http://localhost:8983/solr/browse?indent=onhl=onhl.fl=name,manusort=score+ascsfield=storejson.nl=mapwt=jsonrows=10start=0q={!func}geodist%28%29pt=45.17614%2C-93.87341fq=%28name%20:+%28canon%29%29^8

I have to say I need the calculated distance as a return field (score)
in the result list.
The pseudo field solution described here
http://wiki.apache.org/solr/SpatialSearch#Returning_the_distance did not
word, so I created the query above.

Thanks,
  Ralf


Am 01.08.2011 22:21, schrieb Smiley, David W.:

Can you demonstrate the bug against the example data?  If so, provide the URL 
please.
~ David

On Aug 1, 2011, at 4:00 PM, Ralf Musick wrote:


Hi,

I combined a spatial distance search with a fulltext search as described
in
http://wiki.apache.org/solr/SpatialSearch#geodist_-_The_distance_function .
I'm using solr 3.3 and that works fine.
BUT, I want to use highlighting of fulltext query words but that does
not work.

Before solr 3.3, I used solr 1.4 with Spatial Search plugin from Jteam
and that works fine also with highlighting.

After refactoring because of API change I miss the highlighting feature.

Is that a known issue? Or what is my mistake/ I have to do?

Example Query:
INFO: [organisations] webapp=/solr path=/select
params={hl.fragsize=250sort=score+ascsfield=store_lat_lonjson.nl=maphl.fl=name,category_namewt=jsonhl=onrows=10fl=id,name,street,city,score,lat,lngstart=0q={!func}geodist()pt=52.5600917,13.4222482fq=((country_name:+(automatisierung))^8+OR+(category_name:+(automatisierung))^10+OR+(sub_category_name:+(automatisierung))^10}
hits=37 status=0 QTime=7


Thanks is Advance,
  Ralf






Re: Spatial Search and Highlighting

2011-08-01 Thread Bill Bell
I think 4.0 supports fl=geodist()

On 8/1/11 3:47 PM, Ralf Musick ra...@gmx.de wrote:

Hi David,

So that As a temporary workaround for older Solr versions, it's
possible to obtain distances by using geodist or geofilt as the only
scoring part of the main query
and Highlighting do not fit together, right?

Ok, than I have to calculate the distance by my own.

Thank you very much for your given information!!

Best regards,
  Ralf



Am 01.08.2011 23:30, schrieb Smiley, David W.:
 Ralf,

 Highlighting (and search relevancy -- the score) is performed on the
user query which must be in the q parameter.  In your case, I see you
placed your geospatial query there and you put your user query into a
filter query fq.  You have them reversed.

 You stated that the returning the distance information on the wiki
didn't work -- that's because those instructions are for Solr 4.0 (not
released yet) -- notice the warning symbol. I recommend that you
calculate the distance yourself since Solr 4.0 isn't out yet. There is
plenty of information on the web on how to calculate the distance
between two lat-lon points using the Haversine algorithm.

 ~ David

 On Aug 1, 2011, at 5:00 PM, Ralf Musick wrote:

 Hi David,

 an example is:
 
http://localhost:8983/solr/browse?indent=onhl=onhl.fl=name,manusort=s
core+ascsfield=storejson.nl=mapwt=jsonrows=10start=0q={!func}geodi
st%28%29pt=45.17614%2C-93.87341fq=%28name%20:+%28canon%29%29^8

 I have to say I need the calculated distance as a return field (score)
 in the result list.
 The pseudo field solution described here
 http://wiki.apache.org/solr/SpatialSearch#Returning_the_distance did
not
 word, so I created the query above.

 Thanks,
   Ralf


 Am 01.08.2011 22:21, schrieb Smiley, David W.:
 Can you demonstrate the bug against the example data?  If so, provide
the URL please.
 ~ David

 On Aug 1, 2011, at 4:00 PM, Ralf Musick wrote:

 Hi,

 I combined a spatial distance search with a fulltext search as
described
 in
 
http://wiki.apache.org/solr/SpatialSearch#geodist_-_The_distance_funct
ion .
 I'm using solr 3.3 and that works fine.
 BUT, I want to use highlighting of fulltext query words but that does
 not work.

 Before solr 3.3, I used solr 1.4 with Spatial Search plugin from
Jteam
 and that works fine also with highlighting.

 After refactoring because of API change I miss the highlighting
feature.

 Is that a known issue? Or what is my mistake/ I have to do?

 Example Query:
 INFO: [organisations] webapp=/solr path=/select
 
params={hl.fragsize=250sort=score+ascsfield=store_lat_lonjson.nl=ma
phl.fl=name,category_namewt=jsonhl=onrows=10fl=id,name,street,cit
y,score,lat,lngstart=0q={!func}geodist()pt=52.5600917,13.4222482fq
=((country_name:+(automatisierung))^8+OR+(category_name:+(automatisier
ung))^10+OR+(sub_category_name:+(automatisierung))^10}
 hits=37 status=0 QTime=7


 Thanks is Advance,
   Ralf






Re: Spatial Search with distance as a parameter

2011-07-19 Thread Smiley, David W.
Hi Michael,

It appears that you want to index circles (aka point-radius) and you want to do 
a query that is a point that matches documents where this point is within an 
indexed circle. I'm working with a couple Lucene/Solr committers on a 
geospatial module that can do this today against Solr 4 (trunk), but it's rough 
on the edges and needs testing.  In the mean time, I suggest you look at this 
post from Spaceman Steve in which he indexed lat-lon boxes and he has a query 
box.  With a bit of creativity, you may be able to adapt it to your needs.

http://lucene.472066.n3.nabble.com/intersecting-map-extent-with-solr-spatial-documents-tc3104098.html

~ David Smiley
Author: http://www.packtpub.com/solr-1-4-enterprise-search-server/

On Jul 19, 2011, at 6:14 AM, Michael Lorz wrote:

 Hi all,
 
 I have the following problem: The documents in the index of my solr instance 
 correspond to persons. Each document (=person) has lat/lon coordinates and 
 additionally a travel radius. The coordinates correspond to the office of the 
 person, the travel radius indicates a distance which the person is willing to 
 travel.
 
 I would like to search for all persons which are willing to travel to a 
 particular place (also given as lat/lon coordinates). In other words I have 
 to 
 do a query with the geofilt filter. The problem here: the distance parameter 
 d 
 cannot be defined in advance, but should correspond to the travel radius 
 (which 
 may be different for each person).
 
 Any ideas how this problem could be solved?
 
 Thanks in advance
 Michi





Re: Spatial search with SolrJ 3.1 ? How to

2011-05-19 Thread Yonik Seeley
On Thu, May 19, 2011 at 8:52 AM, martin_groenhof
martin.groen...@yahoo.com wrote:
 How do you construct a query in java for spatial search ? not the default
 solr REST interface

It depends on what you are trying to do - a spatial request (as
currently implemented in Solr) is typically more than just a query...
it can be filtering by a bounding box, filtering by a distance radius,
 or using a distance (geodist) function query in another way such as
sorting by it or using it as a factor in relevance.


-Yonik
http://www.lucenerevolution.org -- Lucene/Solr User Conference, May
25-26, San Francisco


Re: Spatial search with SolrJ 3.1 ? How to

2011-05-19 Thread martin_groenhof
I don't care about the method, I just want results within let's say 10km of a
lat,lng ?

(I can do this with REST) but don't know how to with a Java API

[code]SpatialOptions spatialOptions =
new SpatialOptions(company.getLatitude() + , +
company.getLongitude(),
10, new SchemaField(geolocation, null), searchName, 20,
DistanceUnits.KILOMETERS);

LatLonType latLonType = new LatLonType();

Query query = latLonType.createSpatialQuery(new
SpatialFilterQParser(searchString.toString(), solrq, solrq, null, true),
spatialOptions);[/code]

(I am trying with this, but it does not seem to be compatible with solr only
lucene)

Any example will do, Thx

--
View this message in context: 
http://lucene.472066.n3.nabble.com/Spatial-search-with-SolrJ-3-1-How-to-tp2961136p2961452.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Spatial search - SOLR 3.1

2011-05-15 Thread Bill Bell
Look up a few lines to see q={!func}geodist()

...q={!func}geodist()sfield=storept=45.15,-93.85sort=score asc

http://localhost:8983/solr/select?wt=jsonindent=truefl=name,store,score;
q={!func}geodist()sfield=storept=45.15,-93.85sort=score+asc


On 5/11/11 9:25 AM, Smiley, David W. dsmi...@mitre.org wrote:

Hi Roy.

See this:
http://wiki.apache.org/solr/SpatialSearch#Returning_the_distance

I recommend returning the point location and calculating the distance
yourself -- it's not hard.  Getting Solr to return it is a bit of a hack
now.

~ David Smiley
Author: http://www.packtpub.com/solr-1-4-enterprise-search-server/

On May 11, 2011, at 10:55 AM, roySolr wrote:

 Hello,
 
 I'm using the spatial solr plugin from jteam for SOLR 1.4. Now i want
to use
 SOLR 3.1 because it contains
 a lot of bugfixes:) Now i want to get a distance field back in my
results.
 How can i do it?
 
 My url looks like:
 
 q=testqueryfq={!geofilt pt=52.78556,3.4546 sfield=latlon d=50}
 
 I get only the results between the distance(50 km) and that's great. I
only
 missing the
 distance field for every document in the response.
 
 --
 View this message in context:
http://lucene.472066.n3.nabble.com/Spatial-search-SOLR-3-1-tp2927579p2927
579.html
 Sent from the Solr - User mailing list archive at Nabble.com.






Re: Spatial search - SOLR 3.1

2011-05-12 Thread roySolr
Hello David,

It's easy to calculate it by myself but it was nice if SOLR returns distance
in the response. I can sort
on distance and calculate the distance with PHP to show it to the users.

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


Re: Spatial search - SOLR 3.1

2011-05-11 Thread Smiley, David W.
Hi Roy.

See this:
http://wiki.apache.org/solr/SpatialSearch#Returning_the_distance

I recommend returning the point location and calculating the distance yourself 
-- it's not hard.  Getting Solr to return it is a bit of a hack now.

~ David Smiley
Author: http://www.packtpub.com/solr-1-4-enterprise-search-server/

On May 11, 2011, at 10:55 AM, roySolr wrote:

 Hello,
 
 I'm using the spatial solr plugin from jteam for SOLR 1.4. Now i want to use
 SOLR 3.1 because it contains
 a lot of bugfixes:) Now i want to get a distance field back in my results.
 How can i do it?
 
 My url looks like:
 
 q=testqueryfq={!geofilt pt=52.78556,3.4546 sfield=latlon d=50} 
 
 I get only the results between the distance(50 km) and that's great. I only
 missing the
 distance field for every document in the response.
 
 --
 View this message in context: 
 http://lucene.472066.n3.nabble.com/Spatial-search-SOLR-3-1-tp2927579p2927579.html
 Sent from the Solr - User mailing list archive at Nabble.com.




Re: Spatial Search

2011-04-29 Thread Jonas Lanzendörfer
I did the String Solution, works great, thank you!

Am 29.04.2011 um 00:25 schrieb Jan Høydahl:

 1) Create an extra String field on your bean as Yonik suggests or
 2) Write an UpdateRequestHandler which reads the doubles and creates the 
 LatLon from that
 
 --
 Jan Høydahl, search solution architect
 Cominvent AS - www.cominvent.com
 
 On 28. apr. 2011, at 14.44, Yonik Seeley wrote:
 
 On Thu, Apr 28, 2011 at 5:15 AM, Jonas Lanzendörfer
 jonas.lanzendoer...@affinitas.de wrote:
 I am new to solr and try to use the spatial search feature which was added 
 in 3.1. In my schema.xml I have 2 double fields for latitude and longitude. 
 How can I get them into the location field type? I use solrj to fill the 
 index with data. If I would use a location field instead of two double 
 fields, how could I fill this with solrj? I use annotations to link the 
 data from my dto´s to the index fields...
 
 
 I've not used the annotation stuff in SolrJ, but since the value sent
 in must be of the for 10.3,20.4 then
 I guess one would have to have a String field with this value on your object.
 
 
 -Yonik
 http://www.lucenerevolution.org -- Lucene/Solr User Conference, May
 25-26, San Francisco
 



Re: Spatial Search

2011-04-28 Thread Yonik Seeley
On Thu, Apr 28, 2011 at 5:15 AM, Jonas Lanzendörfer
jonas.lanzendoer...@affinitas.de wrote:
 I am new to solr and try to use the spatial search feature which was added in 
 3.1. In my schema.xml I have 2 double fields for latitude and longitude. How 
 can I get them into the location field type? I use solrj to fill the index 
 with data. If I would use a location field instead of two double fields, how 
 could I fill this with solrj? I use annotations to link the data from my 
 dto´s to the index fields...


I've not used the annotation stuff in SolrJ, but since the value sent
in must be of the for 10.3,20.4 then
I guess one would have to have a String field with this value on your object.


-Yonik
http://www.lucenerevolution.org -- Lucene/Solr User Conference, May
25-26, San Francisco


Re: Spatial Search

2011-04-28 Thread Jan Høydahl
1) Create an extra String field on your bean as Yonik suggests or
2) Write an UpdateRequestHandler which reads the doubles and creates the LatLon 
from that

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com

On 28. apr. 2011, at 14.44, Yonik Seeley wrote:

 On Thu, Apr 28, 2011 at 5:15 AM, Jonas Lanzendörfer
 jonas.lanzendoer...@affinitas.de wrote:
 I am new to solr and try to use the spatial search feature which was added 
 in 3.1. In my schema.xml I have 2 double fields for latitude and longitude. 
 How can I get them into the location field type? I use solrj to fill the 
 index with data. If I would use a location field instead of two double 
 fields, how could I fill this with solrj? I use annotations to link the data 
 from my dto´s to the index fields...
 
 
 I've not used the annotation stuff in SolrJ, but since the value sent
 in must be of the for 10.3,20.4 then
 I guess one would have to have a String field with this value on your object.
 
 
 -Yonik
 http://www.lucenerevolution.org -- Lucene/Solr User Conference, May
 25-26, San Francisco



Re: Spatial Search

2011-02-16 Thread Stefan Matheis
Nishant,

correct me if i'm wrong .. but spatial search normally requires
geo-information, like latitude and longitude to work? so you would
need to fetch this information before putting them into solr. the
google maps api offers
http://code.google.com/intl/all/apis/maps/documentation/geocoding/#ReverseGeocoding
(for example)

Regards
Stefan

On Wed, Feb 16, 2011 at 1:58 PM,  nishant.an...@birlasoft.com wrote:
 Hi,
 I have very typical problem. From one of my applications I get data in the 
 format
 add
            doc
                        field name=address Some Address/field
      field name=zipcode1/field
 /doc
 /add

 How can I implement a spatial search for this data?
 Any ideas are welcome


 Regards,
 Nishant Anand


 
 This message and any attachments are solely for the intended recipient and 
 may contain Birlasoft confidential or privileged information. If you are not 
 the intended
 recipient,any disclosure, copying, use, or distribution of the information 
 included in this message and any attachments is prohibited. If you have 
 received this communication
  in error, please notify us by reply e-mail(mailad...@birlasoft.com) 
 immediately and permanently delete this message and any attachments.
 Thank you.
 



Re: Spatial search - Solr 4.0

2010-12-07 Thread Erick Erickson
What version of solr are you using? What is your configuration?
What query are you using?

Best
Erick

On Tue, Dec 7, 2010 at 5:40 PM, Jae Joo jaejo...@gmail.com wrote:

 Hi,

 I am implementing spatial search and found some odd things. As I know that
 the returning distance is still being implemented, so I have implement
 algorithm to calculate the actual distance based on lat and long returned.
 when I do it, I have found the sort is not working properly. Any thing I
 missed?

 Jae



Re : Spatial Search

2010-12-01 Thread js . vachon
check jteam's spatial search plugin. 
very easy to install


Aisha Zafar aishazafar...@yahoo.com a écrit

 Hi ,
 
 I am a newbie of solr. I found it really interesting specially spetial 
 search. I am very interested to go in its depth but i am facing some problem 
 to use it as i have 1.4.1 version installed on my machine but the spetial 
 search is a feature of 4.0 version which is not released yet. I have also 
 read somewhere that we can use a patch for this purpose. As i am a newbie I 
 dont know how to install the patch and from where to download it. If anyone 
 could help me i'll be very thankful. 
 
 thanks in advance and bye
 
 
 
 


Cet e-mail a été envoyé depuis un Archos 7.


Re: Spatial Search

2010-12-01 Thread Erick Erickson
1.4.1 spatial is pretty much superseded by geospatial in the current code,
you can
download a nightly build from here:
https://hudson.apache.org/hudson/

Scroll down to Solr-trunk and pick a nightly build that suits you. Follow
the link through
build artifacts and checkout/solr/dist and you'll find the zip/tar files.

Hudson is reporting some kinda flaky failures, but if you look at the
build results you
can determine whether you care. For instance, the Dec-1 build has a red
ball, but
all the tests pass!

Here's a good place to start with geospatial:
http://wiki.apache.org/solr/SpatialSearch

Best
Erick


On Wed, Dec 1, 2010 at 2:35 AM, Aisha Zafar aishazafar...@yahoo.com wrote:

 Hi ,

 I am a newbie of solr. I found it really interesting specially spetial
 search. I am very interested to go in its depth but i am facing some problem
 to use it as i have 1.4.1 version installed on my machine but the spetial
 search is a feature of 4.0 version which is not released yet. I have also
 read somewhere that we can use a patch for this purpose. As i am a newbie I
 dont know how to install the patch and from where to download it. If anyone
 could help me i'll be very thankful.

 thanks in advance and bye







Re: Spatial search in Solr 1.5

2010-11-11 Thread Scott K
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 vettepa...@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

2010-10-13 Thread PeterKerk

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=xmlindent=onfacet=truefl=id,title,lat,lng,cityfacet.field=province_rawq=*:*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

2010-10-13 Thread Yonik Seeley
On Wed, Oct 13, 2010 at 7:28 AM, PeterKerk vettepa...@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=xmlindent=onfacet=truefl=id,title,lat,lng,cityfacet.field=province_rawq=*:*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

2010-10-13 Thread darren
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 vettepa...@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=xmlindent=onfacet=truefl=id,title,lat,lng,cityfacet.field=province_rawq=*:*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

2010-10-13 Thread PeterKerk

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=xmlindent=onfacet=truefl=id,title,lat,lng,cityfacet.field=province_rawq=*:*fq={!geofilt%20pt=51.8316819,5.8151540%20sfield=geolocation%20d=500}


I also tried this:
http://localhost:8983/solr/db/select/?wt=xmlindent=onfacet=truefl=id,title,lat,lng,geolocation,cityfacet.field=province_rawq=*:*

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

2010-10-13 Thread Yonik Seeley
On Wed, Oct 13, 2010 at 9:42 AM, PeterKerk vettepa...@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

2010-10-13 Thread PeterKerk

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

2010-10-13 Thread Yonik Seeley
On Wed, Oct 13, 2010 at 10:06 AM, PeterKerk vettepa...@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

2010-10-13 Thread PeterKerk

ArggghhhI 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

2010-10-12 Thread PeterKerk

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

2010-10-12 Thread Yonik Seeley
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 vettepa...@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.



Re: Spatial search in Solr 1.5

2010-10-12 Thread PeterKerk

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

2010-10-12 Thread Yonik Seeley
On Tue, Oct 12, 2010 at 8:07 PM, PeterKerk vettepa...@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 - Best choice (if any)?

2010-07-16 Thread Dennis Gearon
I hope that those who know will answer this. I am really interested in it also. 
TIA.

Dennis Gearon

Signature Warning

EARTH has a Right To Life,
  otherwise we all die.

Read 'Hot, Flat, and Crowded'
Laugh at http://www.yert.com/film.php


--- On Fri, 7/16/10, Saïd Radhouani r.steve@gmail.com wrote:

 From: Saïd Radhouani r.steve@gmail.com
 Subject: Spatial Search - Best choice (if any)?
 To: solr-user@lucene.apache.org
 Date: Friday, July 16, 2010, 1:21 AM
 Hi,
 
 Using Solr 1.4, I'm now working on adding spatial search
 options, such as distance-based sorting, Bounding-box
 filter, etc.
 
 To the best of my knowledge, there are three possible
 points we can start from: 
 
 1. The 
 http://blog.jteam.nl/2009/08/03/geo-location-search-with-solr-and-lucene/
 2. The gissearch.com
 3. The 
 http://www.ibm.com/developerworks/opensource/library/j-spatial/index.html#resources
 
 
 I saw that these three options have been used but didn't
 see any comparison between them. Is there any one out there
 who can recommend one option over another? 
 
 Thanks,
 -S


Re: Spatial Search - Best choice (if any)?

2010-07-16 Thread Dave Searle
I'm also just starting a project requiring spatial indexing so any info would 
be greatly appreciated. I had a quick look at the wiki last night and it 
appears solr has it built in in the latest version? Not sure if the patches 
need applying directly though 

My requirements are quite simple, I just need an ability to return results 
based on radial distance from one point

http://wiki.apache.org/solr/SpatialSearch 

Thanks
Dave

Sent from my iPhone

On 16 Jul 2010, at 17:50, Dennis Gearon gear...@sbcglobal.net wrote:

 I hope that those who know will answer this. I am really interested in it 
 also. TIA.
 
 Dennis Gearon
 
 Signature Warning
 
 EARTH has a Right To Life,
  otherwise we all die.
 
 Read 'Hot, Flat, and Crowded'
 Laugh at http://www.yert.com/film.php
 
 
 --- On Fri, 7/16/10, Saïd Radhouani r.steve@gmail.com wrote:
 
 From: Saïd Radhouani r.steve@gmail.com
 Subject: Spatial Search - Best choice (if any)?
 To: solr-user@lucene.apache.org
 Date: Friday, July 16, 2010, 1:21 AM
 Hi,
 
 Using Solr 1.4, I'm now working on adding spatial search
 options, such as distance-based sorting, Bounding-box
 filter, etc.
 
 To the best of my knowledge, there are three possible
 points we can start from: 
 
 1. The 
 http://blog.jteam.nl/2009/08/03/geo-location-search-with-solr-and-lucene/
 2. The gissearch.com
 3. The 
 http://www.ibm.com/developerworks/opensource/library/j-spatial/index.html#resources
 
 
 I saw that these three options have been used but didn't
 see any comparison between them. Is there any one out there
 who can recommend one option over another? 
 
 Thanks,
 -S


Re: Spatial Search - Best choice ?

2010-07-15 Thread findbestopensource
Some more pointers to spatial search,

http://www.jteam.nl/products/spatialsolrplugin.html
http://code.google.com/p/spatial-search-lucene/
http://sujitpal.blogspot.com/2008/02/spatial-search-with-lucene.html

Regards
Aditya
www.findbestopensource.com



On Thu, Jul 15, 2010 at 3:54 PM, Saïd Radhouani r.steve@gmail.comwrote:

 Hi,

 Using Solr 1.4, I'm now working on adding spatial search options, such as
 distance-based sorting, Bounding-box filter, etc.

 To the best of my knowledge, there are three possible points we can start
 from:

 1. The
 http://blog.jteam.nl/2009/08/03/geo-location-search-with-solr-and-lucene/
 2. The gissearch.com
 3. The
 http://www.ibm.com/developerworks/opensource/library/j-spatial/index.html#resources

 I saw that these three options have been used but didn't see any comparison
 between them. Is there any one out there who can recommend one option over
 another?

 Thanks,
 -S


Re: Spatial Search - Best choice ?

2010-07-15 Thread Saïd Radhouani
Thanks for the links, but this makes things even harder :) Do you have any 
recommendations for one pointer over another?

Thanks,
-S


On Jul 15, 2010, at 1:08 PM, findbestopensource wrote:

 Some more pointers to spatial search,
 
 http://www.jteam.nl/products/spatialsolrplugin.html
 http://code.google.com/p/spatial-search-lucene/
 http://sujitpal.blogspot.com/2008/02/spatial-search-with-lucene.html
 
 Regards
 Aditya
 www.findbestopensource.com
 
 
 
 On Thu, Jul 15, 2010 at 3:54 PM, Saïd Radhouani r.steve@gmail.comwrote:
 
 Hi,
 
 Using Solr 1.4, I'm now working on adding spatial search options, such as
 distance-based sorting, Bounding-box filter, etc.
 
 To the best of my knowledge, there are three possible points we can start
 from:
 
 1. The
 http://blog.jteam.nl/2009/08/03/geo-location-search-with-solr-and-lucene/
 2. The gissearch.com
 3. The
 http://www.ibm.com/developerworks/opensource/library/j-spatial/index.html#resources
 
 I saw that these three options have been used but didn't see any comparison
 between them. Is there any one out there who can recommend one option over
 another?
 
 Thanks,
 -S



Re: Spatial Search - Best choice ?

2010-07-15 Thread Chris Hostetter

: Subject: Spatial Search - Best choice ?
: In-Reply-To: aanlktini0kos5qgoiqnnrqd4ysdcsukt-eoam6s1q...@mail.gmail.com
: References: aanlktini0kos5qgoiqnnrqd4ysdcsukt-eoam6s1q...@mail.gmail.com

http://people.apache.org/~hossman/#threadhijack
Thread Hijacking on Mailing Lists

When starting a new discussion on a mailing list, please do not reply to 
an existing message, instead start a fresh email.  Even if you change the 
subject line of your email, other mail headers still track which thread 
you replied to and your question is hidden in that thread and gets less 
attention.   It makes following discussions in the mailing list archives 
particularly difficult.
See Also:  http://en.wikipedia.org/wiki/User:DonDiego/Thread_hijacking



-Hoss



Re: Spatial search in Solr 1.5

2010-03-16 Thread Grant Ingersoll

On Mar 15, 2010, at 11:36 AM, Jean-Sebastien Vachon wrote:

 Hi All,
 
 I'm trying to figure out how to perform spatial searches using Solr 1.5 (from 
 the trunk).
 
 Is the support for spatial search built-in?

Almost.  Main thing missing right now is filtering.  There are still ways to do 
spatial filtering, but it isn't complete yet.  In the meantime, range queries 
and or frange might help.

 because none of the patches I tried could be applied to the source tree.
 If this is the case, can someone one tell me how to configure it?

http://wiki.apache.org/solr/SpatialSearch has most of the docs, but they aren't 
complete yet.

Here's what I would do:
Check out latest Solr
Build the example: ant clean example
Start the example: cd example; java -jar start.jar
Rebuild the index: cd exampledocs; java -jar post.jar *.xml
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.

Next, have a look at the docs in exampledocs and specifically the store field, 
which contains the location.  Then go check out the schema for that field.

HTH,
Grant

--
Grant Ingersoll
http://www.lucidimagination.com/

Search the Lucene ecosystem using Solr/Lucene: 
http://www.lucidimagination.com/search



Re: Spatial search using R-tree for indexed bounding boxes

2009-03-11 Thread pjaol

There are many spatial solutions out there
- R-tree
- Quad-Tree
- SRID with positional proximity like geohash
- Voronoi diagrams
etc..

All have their pros  cons as do Cartesian grids.
Feel free to contribute the more there are, the more solutions that can be
applied to different problems, I use a Cartesian method meets my needs for
my work which has a substantial data set. 

If you look at the LocalSolr implementation of LocalLucene you'll notice
that there are 
multiple grids indexed at different levels / tiers. In a very similar
fashion to Quad-Trees.

The reason, you can 'zoom' in as low as you need to.

There are multiple filters occurring for the geo filters in locallucene,
first is an MMB based
on bestFit or zoom level, then afterwards those results are filtered by your
text intersection
and finally by a radial filter. 
The MMB filter, pre-generates the shape or in this case box with all the
id's you're interested in
and using a TermEnumerator pulls those from the index. As the id's are
stored in a sorted fashion
it's a very fast retrieval. Without having to manage memory or a data
structure outside of lucene.

Storing multiple points is possible, doing a radial filter, or sorting on
distance (which is what my work
depends on) is tricky as I use FieldCache to retrieve actual points quickly.
Multiple values in a field cache
dont work. But I am looking at the Uninverted Field method of solr facets
for that.
You will have the same issue no matter what method you use, unless you don't
care
about distance.

If you want to do something more complex like polygon's, you extend the
Shape's class, and create
either another MMB or convex hull method. 
Basically my belief is, that it's faster to find something if you know what
your looking for.
i.e. grid / box id's
The bestFit method essentially lets you skip traversing and just get to the
level you want.
Pre-generate the id's used in a shape, and simply pull them out of the
index.




hossman wrote:
 
 
 : Patrick (of local lucene fame) thinks it is possible to do extent
 queries with
 : the cartesian grid method -- essentially you select the best fit level
 and
 : cell, and that should be set for anything within the extent.  The
 advantage of
 : this approach is that it is super-fast and scaleable.  The disadvantage
 is
 : that it is only as accurate as the grid.
 
 i'm way out of my league on spatial search -- but couldn't you use the 
 grid method to whittle down the result space, and then do the computation 
 to determine if a true overlap exists?
 
 
 -Hoss
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Spatial-search-using-R-tree-for-indexed-bounding-boxes-tp22318859p22462731.html
Sent from the Solr - User mailing list archive at Nabble.com.



Re: Spatial search using R-tree for indexed bounding boxes

2009-03-03 Thread Ryan McKinley


Are there any easily foreseeable problems with implementing an r- 
tree box
indexing/searching extension to Solr, in the spirit of localsolr? If  
anyone

has any pointers I'm all ears.


I have implemented an R-Tree based integration for solr.  It is pretty  
ugly and memory intensive, but works for now.  I plan to release it  
(or something like it) in the lucene spatial contrib sometime.  I am  
waiting to see what the Flexible indexing thread leads since that  
may be a good way to just build the R-Tree at index time rather then  
every time you open a searcher.


In my current approach, I store a string representing a bounding box.   
When you open a searcher, it walks through every document and builds  
an in memory R-Tree.  Then I have a solr query component that applies  
a filter based on what matches.


- - - - -

Patrick (of local lucene fame) thinks it is possible to do extent  
queries with the cartesian grid method -- essentially you select the  
best fit level and cell, and that should be set for anything within  
the extent.  The advantage of this approach is that it is super-fast  
and scaleable.  The disadvantage is that it is only as accurate as the  
grid.


ryan