Hello,

Been wondering if it would be possible to create a Google Maps facet based on Geofield?
http://drupal.org/project/geofield

If the user zooms or drags the maps it could alter the visible values.

For non Drupal concept: http://clipglobe.com

Comments

cpliakas’s picture

Component: Miscellaneous » Contrib

This is a great feature request. It won't get into the core module, but I believe there is work being done in the Apachesolr Geo sandbox module that will satisfy this request.

Thanks,
Chris

batje’s picture

There is a working module as well search_api location demo is here

gnucifer’s picture

Apachesolr Geo is pretty unfinished, but I have forked module here: https://github.com/david-xelera/Apachesolr-geo/tree/david-xelera as I needed this for a customer project. Works great, but I needed to patch facetapi and geofield to get it working (for facetapi I needed query_types to be able to have settings, and for geofield removed the broken apachesolr field mappings implementation). Don't have much time on my hands right now, but stay tuned and I will clean it up some more and provide the required patches.

batje’s picture

@gnucifer I am sure a lot of people would be interested in your progress

nick_vh’s picture

@gnucifer, I'm also interested in the hacks you performed! Please share

gnucifer’s picture

StatusFileSize
new3.56 KB

Ok, here is the patch for facetapi against latest 7.x-1.x-dev (not 7.x-2.x-dev since I was using the 1.x-branch).

gnucifer’s picture

StatusFileSize
new999 bytes

Here's a patch needed for apachesolr (for sorting by geodistance).

gnucifer’s picture

And here is a patch to comment out all (broken) apachesolr integration in the geofield module. That should be it I think.

cpliakas’s picture

Status: Active » Needs review

Thanks! Marking as needs review so the testbot can hack at #6.

Also, currently the 7.x-1.x and 7.x-2.x branches are exactly the same :-). Thre has been no 2.x type work, as I feel that 1.x is in good shape and also would benefit from all of my attention right now.

Thanks for sharing!
Chris

Status: Needs review » Needs work

The last submitted patch, geofield-remove-apachesolr-integration.patch, failed testing.

cpliakas’s picture

Status: Needs work » Needs review

Tests pass for #6, which is the one we care about. Switching back to "needs review".

giorgio79’s picture

I notice the patch is based on http://drupal.org/project/date_facets as per the code here https://github.com/david-xelera/Apachesolr-geo/blob/david-xelera/apaches...

Would be best to release it as a Distance Facet module :)

Also found this great snippet http://stackoverflow.com/questions/6035270/faceting-on-distance-in-solr-...

giorgio79’s picture

Based on gnucifer's code I started a Distance Facet sandbox here:
http://drupal.org/sandbox/giorgio79/1889026

I added to comaintainers cpliakas, Nick_vh, batje, gnucifer and a few other people, so you can commit right away if you feel like it :)

Any help and comaintainership is appreciated :)

At the moment, it is just a rip of gnucifer's code that I tried to align with Date Facets structure, and it does not work yet.

gnucifer’s picture

Nice! Maybe I'm missing something but I have already implemented a distance facet. I will check though so I don't have un-commited code locally, and that the git-hub version is actually up-to-date.

giorgio79’s picture

Thanks gnucifer. Your module was geared for ApacheSolr with a distance facet, so I pretty much ripped out the Facet part, and aligned it based on Date Facets module structure. I notice you based your code on Date Facets as well :)

gnucifer’s picture

Aha, I think I actually based some code on the apachesolr-modules facet-api-integration (the date part) :). I am not familiar with the Date Facets module and as you say have focused on Apachesolr-integration. To see it in action, here is a site we made using my branch of the apachesolr_geo-module: http://benders.d7.xelera.biz

(Must search within Sweden, Norway or Finland to get results, so search for "Stockholm" for example.)

giorgio79’s picture

I am stuck at converting ApacheSolr addParams to SearchAPI / FacetAPI addFacetFilters. Any tips? Issue at #1891958: What is the equivalent of ApacheSolr addParam in FacetApi / Search API?

bjcone’s picture

@gnucifer,

I would be very interested in your module to expose distance facets. I'm working on a project which requires a proximity search in addition to other exposed facets. I have tried creating my own facet and widget with marginal success. Based on your demo site, what you have looks like what I'm looking for. Is the code available somewhere?

batje’s picture

@bjcone You might want to checkout https://drupal.org/project/search_api_location

gnucifer’s picture

@bjocone
The code is available here: https://github.com/david-xelera/Apachesolr-geo

It's not exactly production ready though as some parts are hardcoded for the specific use-case. Plus I have not ran it against the latest version of the apache solr / facet API modules. I would like to have more time to finish it but it will unfortunately not be in the near future because of other engagements.

cpliakas’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)

Great work all.

Closing as "won't fix" since the code is being worked on elsewhere.

Thanks for the contributions!
Chris

The last submitted patch, 7: apachesolr-regexp-escape.patch, failed testing.