For several months I am wondering how to achieve this task.

I want to display information from Solr index (preferably Search Api Solr ) directly in a map. The main goal is to have a map where is displayed some nodes, and to have the ability the use facet filters and fulltext filter.

Exactly the same as a typical use of Search Api Solr (example: http://ygerasimov.com/ajaxified-solr-search-drupal-search-api-views-panels) but using a map instead of a table.

Something like this: http://vps10937.ovh.net/x/map/node, but with Solr features. This page is part of the Location Module and the Gmap Module.

Here is two examples (not drupal) close to what I want to do:

http://www.trulia.com/for_sale/New_York,NY/x_map http://www.conflicthistory.com/#/period/1495-1500

Thank you

2 Answers 2


I have been able to accomplish this task following these steps:

  • Installed modules for search: search_api, search_api_location, search_api_solr search_api_views, search_api_facetapi, Search API location views

  • Installed modules for "geosearch": geofield (to store lat, lon...), addressfield (make it easier for users to enter an address and don't worry about geolocation).

  • Installed modules for mapping: leaflet, leaflet_more_maps (for more maptiles options out of the box).

  • Solr server 4.7.1 (I've just downloaded today)

So, with all these things, my goal is to have a view with an exposed full text field and show the results in a map (and afterwards be able to facet this view).

I've started like this:

  1. Create a content type with address field and geofield fields
  2. Set geofield field widget to "Geocode from another field" (and geocode from Address field using google geocoder). Not multivalued fields allowed here.
  3. Create a solr server and make sure it runs ok.
  4. Create an index connecting with the solr server (Remember this name for later)
  5. Add fields to the index, just making it simple:

    a) nid

    b) title

    c) Save changes

    d) Add related fields (collapsible fieldset right bellow save button)

    e) We choose "Geofield" (Watch out here, if you share the geofield field between two or more different content types, you need to add this field twice or more and it is not easy to distinguish them because they have same name in the UI)

    f) Now we have added geofield as related field, we should have the option to choose "Geofiled » LatLong Pair" and as type "Latitude/longitude" as a field for indexing in solr

  6. Disable the index, disable the server, enable the server and enable the index, and some clear cache between them. Important to do this.

  7. Once we have server and index enabled, just index all items.
  8. If we now go to the solr interface, and run a query for all results, we should see a field (among the others we have indexed) which is called something like "locs_your_field_name$latlon" (Notice here that older versions use ":" instead of "$" ). If you can't see it, review before steps.
  9. Now we can set up a simple view:

    a) Create a new view

    b) Set up a name and description for the view

    c) Select "Show" (content is default, we want to change this): The name of the index that you set before, Remember?

    d) Create a page: "myviewpath"

    e) Save

    f) Select fields: "Indexed Node: Node Id" and "Indexed Node: Geofield"

    g) Filter criteria: "Search: Fulltext search" -> Exposed filter

    h) Format: Unformated list

    i) Test and see if we have results, if not, something went wrong, review.

    j) Format (again): "Leaflet Map"

    k) Data Source: Indexed Node: Geofield

    l) Title field: Indexed Node: Nid

    m) Description: Indexed Node: Nid

    n) Map: Choose from list the one you like the most

    o) Map height: 400px

    p) Save format

    q) Save view. At this point, the map is not visible (in views UI), but if everything is ok...

  10. Go to the path of your view: You should see all results in the map (if you have the default solr server configuration). If not, try to type some text and see if you get the expected results...

Hope this helps!

  • Thanks, this is working well. Just a point: search_api_location and search_api_location_views modules aren't required.
    – 118218
    Commented Aug 14, 2015 at 16:33
  • I think the Geocoder module is required for "Geocode from another field"
    – pmagunia
    Commented Jul 9, 2017 at 1:02

You can use the Openlayers Apachesolr integration module. This will create a map with your content. This uses apachesolr not search api solr. You can however use facet API to achieve almost what you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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