You are viewing a plain text version of this content. The canonical link for it is here.
Posted to zeta-dev@incubator.apache.org by David Rekowski <da...@gmx.de> on 2011/10/11 10:15:36 UTC

[zeta-dev] ezcSearch: support for geo distance search

Hello list.

Please find attached, a proposal for geo distance search support of solr.

I'd like to point out a few issues I still see:

1) I figured altering the interface would be a bad idea, so I opted for
altering ezcSearchQuerySolr::eq() to handle distance search fields. This
is not extraordinarily pretty, but IMHO acceptable.

2) I added a struct for the search value, i.e. a geoposition (lat,lng)
and a distance (km). Search field and value are stored in the query
object in eq().

3) ezcSearchSolrHandler::find() extracts a number of values from $query
and passes them to search(). In order to add the geoposition search
field and values, I had to extend search() and buildQuery() by these
parameters. I wonder, why search() is not integrated into find() or
$query passed to search() as a whole.

4) I had to alter the $queryWord join() command in find() in order to
remove the NULL element present due to adding the geoposition search
field via eq().


Afterthought: It looks as if ezcSearchSolrHandler might be extended by
something like filterDistance($field, $value) without affecting the
interface, which should eleminate the flaws I pointed out in 1) and 4).


I would appreciate your comments and hints on oversights or problems.
Also tell me what I should do next if there is a chance to integrate the
geo distance search functionality to ezcSearch. Thanks.

Best regards,
  David

-- 
David Rekowski
mailto:david.rekowski@gmx.de


Re: [zeta-dev] ezcSearch: support for geo distance search

Posted by David Rekowski <da...@gmx.de>.
I opened an issue on JIRA regarding this:

  https://issues.apache.org/jira/browse/ZETACOMP-96

- David

-- 
David Rekowski
mailto:david.rekowski@gmx.de


Re: [zeta-dev] ezcSearch: support for geo distance search

Posted by David Rekowski <da...@gmx.de>.
David Rekowski schrieb:
> Hello list.
> 
> Please find attached, a proposal for geo distance search support of solr.
> 
<snip />
> 
> Afterthought: It looks as if ezcSearchSolrHandler might be extended by
> something like filterDistance($field, $value) without affecting the
> interface, which should eleminate the flaws I pointed out in 1) and 4).

Please find attached another version of the implementation. This time by
adding filterDistance() to the solr search handler. I consider it a
cleaner approach, not tainting eq() and only suffering from the long
argument list issue in search() and buildQuery().

(The solr_geoposition.php file is the same as before, only attached for
completeness' sake)

- David

-- 
David Rekowski
mailto:david.rekowski@gmx.de


Re: [zeta-dev] ezcSearch: support for geo distance search

Posted by David Rekowski <da...@gmx.de>.
Henri Bergius schrieb:
> On Tue, Oct 11, 2011 at 1:48 PM, David Rekowski <da...@gmx.de> wrote:
>> surely useful in itself, but since we don't do anything other than
>> storing and retrieving the properties, I don't see, how we could benefit
>> from the functionality it provides. I will keep that in mind though, for
>> other uses.
> 
> * Distances between points that you get from SOLR results (and other
> arbitrary points)
> * Geocoding and reverse geocoding (it might be nice to show "Helsinki,
> Finland" instead of coordinates or just distance)

I understand what your class does in general, but as I said: the geo
position struct is only passed into the search handler, never to be
returned again. The only use I can see is to calculate the distance for
each return result to the starting point, which would be another special
handling. Since this is not necessarily needed in all cases, personally
I would do this later after retrieving the result. Then, your class can
be used, but that's outside ezcSearch.

- David


-- 
David Rekowski
mailto:david.rekowski@gmx.de


Re: [zeta-dev] ezcSearch: support for geo distance search

Posted by Henri Bergius <he...@iki.fi>.
On Tue, Oct 11, 2011 at 1:48 PM, David Rekowski <da...@gmx.de> wrote:
> surely useful in itself, but since we don't do anything other than
> storing and retrieving the properties, I don't see, how we could benefit
> from the functionality it provides. I will keep that in mind though, for
> other uses.

* Distances between points that you get from SOLR results (and other
arbitrary points)
* Geocoding and reverse geocoding (it might be nice to show "Helsinki,
Finland" instead of coordinates or just distance)

> - David

/Henri

-- 
Henri Bergius
Motorcycle Adventures and Free Software
http://bergie.iki.fi/

Jabber: henri.bergius@gmail.com
Microblogs: @bergie

Re: [zeta-dev] ezcSearch: support for geo distance search

Posted by David Rekowski <da...@gmx.de>.
Henri,

Henri Bergius schrieb:
> Hi,
> 
> On Tue, Oct 11, 2011 at 1:15 PM, David Rekowski <da...@gmx.de> wrote:
>> Please find attached, a proposal for geo distance search support of solr.
>> 2) I added a struct for the search value, i.e. a geoposition (lat,lng)
>> and a distance (km). Search field and value are stored in the query
>> object in eq().
> 
> Looks useful!
> 
> However, instead of using your own class for locations, how about
> using the more full-featured one from my location library?
> https://github.com/bergie/midgardmvc_helper_location/blob/master/spot.php
> (I know, LGPL and not in Zeta yet. I should really finish the porting)

surely useful in itself, but since we don't do anything other than
storing and retrieving the properties, I don't see, how we could benefit
from the functionality it provides. I will keep that in mind though, for
other uses.

- David

-- 
David Rekowski
mailto:david.rekowski@gmx.de


Re: [zeta-dev] ezcSearch: support for geo distance search

Posted by Henri Bergius <he...@iki.fi>.
Hi,

On Tue, Oct 11, 2011 at 1:15 PM, David Rekowski <da...@gmx.de> wrote:
> Please find attached, a proposal for geo distance search support of solr.
> 2) I added a struct for the search value, i.e. a geoposition (lat,lng)
> and a distance (km). Search field and value are stored in the query
> object in eq().

Looks useful!

However, instead of using your own class for locations, how about
using the more full-featured one from my location library?
https://github.com/bergie/midgardmvc_helper_location/blob/master/spot.php
(I know, LGPL and not in Zeta yet. I should really finish the porting)

>  David

/Henri

-- 
Henri Bergius
Motorcycle Adventures and Free Software
http://bergie.iki.fi/

Jabber: henri.bergius@gmail.com
Microblogs: @bergie