Search API Location overhauled
TL; DR:
One of the most sought-after features for the Search API has now finally been completely integrated. After Mattias Michaux implemented proximity searches almost two years ago, I was recently sponsored to polish his code and finally integrate it properly with all related modules, especially Solr search. So now, location support for the Search API is finally the just-enable feature it should be, with the Search API Location module and its new Beta 1 release.
Short history (or: Credit where credit is due)
I vividly remember the Search API BoF in London 2011, when Mattias announced he had integrated the Search API with Geofield, and showed us a demo (which can still be viewed here) where you could filter a search using a Google map. I (along with, I think, most others) was quite impressed. Soon afterwards he released the code in a sandbox, which later became the 2.x branch of Yuriy Gerasimov's Search API Location module (which really integrates with Location, making it sadly a bit of a misnomer for Mattias' module).
However, while it already worked very well, support for this in the Solr module had to be added manually with a patch, an additional processor was required and there were a few other problems. I resolved to fix at least the Solr module, but then never really found the time. Until this January, that is, when I was sponsored by CoEfficient to incorporate location support directly into the Solr module, and generally re-haul the module as well. This was based on an existing sandbox fork of the module, where Matt Grasmick had already implemented several features and bug fixes for the module.
After reviewing what I'd come up with, Mattias agreed to make me co-maintainer of the 2.x branch and I committed my module overhaul to the offical Search API Location project. I also created a first Beta release so people knew this was at least ready to be considered for production.
What's hot and new
So, to cut to the chase, what can you expect with the module's new version?
No more patching
Not really an improvement of the Search API Location module itself, but since RC 3 the Search API Solr Search module has built-in support for indexing and searching location data. Therefore, no more patching or replacing of config files is required. Just enable the Search API Location module and it's working.
Support for geocoding
The module now separates location searches from the Google maps integration and allows specifying the location through other means as well – the most popular one being the Geocoder integration, which allows users to use any of that module's methods for geocoding entered data into a location. This supports the simpler and probably also more common use case of providing a text field for entering the location and (optionally) a distance select box for proximity filtering of search results.
Plugin system for location parsing
Though not really visible to users, the system by which user input is parsed into a location is now completely pluggable, with Geocoder only being one of the default options. Thus, other implementations can easily be added for custom site requirements or different general use cases.
Proper facet support
When a location filter is applied to a search, facets for the same field will automatically switch to allow filtering by distance. The support sadly isn't very flexible yet, but the basic functionality is there and working, and should already be handy for some sites. Sorting by distance is supported in the same way as well. (All of this is specific to Solr, though, so this might not be true for other service classes supporting location searches.)
Sub-modules for Pages and Views support
The primary methods of searching with the Search API, search pages and Views, are both supported by enabling the respective sub-module in the Search API Location project. This avoids overhead when only using one the methods, cleanly separates the code and makes it easier to integrate this with other search methods.
Other stuff
In the course of this project, I also created the Geocoder custom locations module, which allows you to specify custom locations for geocoding (currently requires patching, though) and add autocompletion with this location to arbitrary text input fields. It's not very pretty and rather specialized, but might still be useful to a few others.
Conclusion
In summary, the Search API Location module is now new and shiny, and if you have any use for adding location support to your searches you should definitely give it a try.
One thing we should definitely aim to support better in the future, though, is the Location module, which I think currently isn't working out-of-the-box with this module. Gather in this issue if you'd like to see the Location module supported, too.
Image credit: map © OpenStreetMap contributors, modified image CC-BY-SA by Thomas Seidl