1

I'm trying to implement a search function with location in Drupal.

At the moment I have a base setup with a custom Content Type (Discount), which has a Geofield parameter. This gets indexed in Solr with the proper fields, filters and facets.

Then, after this I see there are two options:

  • One is using directly Search API, which creates a search page with the facets. (Ok, deadly simple and works). Problem: I can't do really strange things like showing stuff on a map.
  • Use Views with Search API: it is also quite simple and I can show the output in a map (as well as I'm more used to them). However, I don't have any idea on how to implement facets there... I took as a reference this project.

I've tried with both this options and I can make them work properly.

So, my question is, how do I add a map to the Search Page in Search API, or how do I add facets into the Views page. I'd rather prefer views if possible, as I'm trying to setup a system which detects all the Discounts in a certain distance in your area, depending on your geolocated IP.

The only idea I have would be to create a Taxonomy, with which I could tag the Discounts with Country and category, and then use that somehow in the view, but not quite sure on how to do so.

Thanks a lot!

0

Ok, I answer myself as I realized what I was doing wrong. Just make sure that the facets you are selecting are the indexed facets, so this way they match with the indexed fields you want to filter by.

It works really nice now!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.