Distance based search with Google Maps integration

This feature gives you the possibility to search for hits in a certain radius around a given zip or city. The hits may optionally be presented on a map (using Google Maps), additionally the distance is shown in the result list. If you want to avoid loading third-party content in the browser you can only use the distance search without the map.

Distance based search with Google Maps integration

System requirements

  • “curl” has to be installed.

  • Activate distance search (see chapter “How to activate the distance search”)

  • This feature does not work together with the boost keywords feature.

  • Since distance calculation is done within MySQL, it is not possible to use “Sphinx” at the same time.

Note

Since version 1.7.3 you can disable Sphinx on certain pages in order to use the distance search on these pages and Sphinx on other pages. Insert this into your page TypoScript setup: ke_search_premium.extconf.override.enableSphinxSearch = 0

Configuration

The distance search configuration can be adjusted using this TypoScript (see Configuration/TypoScript/Distancesearch/setup.typoscript):

plugin.tx_kesearchpremium {
    distancesearch {
        templatepath = EXT:ke_search_premium/Resources/Private/Templates/DistanceSearch/
        radiusoptions = 10,20,50,100,200
        radiuslabel = km
    }
}
page.includeCSS.keSearchPremiumGoogleMapsCss = EXT:ke_search_premium/Resources/Public/Css/google-maps.css

Geocode own content

In order to geocode your own content you will have to create a hook in your own extension and do the geocoding.

Please have a look at the hook modifyAddressIndexEntry (ke_search_premium/Classes/DistanceSearch/DistanceSearch.php) delivered with ke_search_premium.

Troubleshooting

If geocoding or distance search does not work, please check the following:

  • Check if the API key is correct.

  • Check if the country is set in the extension configuration.

  • Check the ke_search log file for errors. If Google Maps returns an error, this will be logged.

Hint

Since ke_search version 6.1.3 you can see the latitude and longitude of the geocoded addresses in the backend. Go to the ke_search backend module and select “Indexed content”, select the sysfolder where the index ist stored.

Show addtional fields