This article outlines how to troubleshoot issues with the search backend related to location searches. Location search is achieved by setting an inferred filter on builtin.location
and returns results based on the distance from the user or location in the search query.
Be sure to follow the How to Start Debugging Backend Search Issues help article for general troubleshooting steps first. Once you resolve your issue, you may skip the remaining steps.
General Troubleshooting Steps
If location search doesn’t seem to be working, start with these troubleshooting steps below. If a step resolves your issue, you may not need to run through the remaining steps.
- Open the search log for the query you’re seeing issues for. Either:
- Navigate to Search > [[Experience Name]] > Test Search or a Configuration sub-tab. Run a test search and then select Debug Query from the drop-down menu.
- If you’ve already run the search in a staging or production link, navigate to Search > [[Experience Name]] > Search Logs and click on the relevant search log. Use the search bar or filters to help you find the correct search log or run the search again to have it appear at the top.
- Check location detection: In the search log metadata, check what is detected as the user location. If this is incorrect, make sure to allow location detection in your browser, then run the search again and review the new search log. If this is still incorrect, submit a support ticket.
- Check inferred filters: In the search log, check if an inferred filter was applied on
builtin.location
for the relevant vertical.- If not, check that the inferred filter is turned on for the field by navigating to Search > [[Experience Name]] > Verticals. Click on the Filters tab. Add the searchable field, click Save, and then run the search again in Test Search on the right-hand side.
- If you already have an inferred filter on for
builtin.location
, check to see if there is an inferred filter conflict where only one inferred filter will be applied, for example between location search and a location subfield likeaddress.region
. You can set an inferred filter order to break ties between the fields. If the conflict ranks above location search, you’ll have to remove it if you’d like location search to be applied.
- Check country restrictions: Check that your configuration includes the relevant countries to search in, which defaults to only the United States if not set.
- Navigate to Search > [[Experience Name]] > General Settings.
- Check the Country Restrictions field includes all countries that should be searchable.
- Check bounding box: Check whether your configuration specifies a bounding box and whether the desired searchable region is contained within that bounding box. Bounding boxes will scope searches to a particular geographic area.
- Navigate to Search > [[Experience Name]] > Edit as JSON.
- Use a tool like bboxfinder to map out any existing bounding box. Confirm this covers the geographic region needed.
- If no bounding box currently exists, consider adding one if the business is local to a region to improve the accuracy of search results.
- Check that results exist: Check that the place being searched has entities nearby that are within the search radius.
- Navigate to Search > [[Experience Name]] > Edit as JSON. Check whether a minimum location radius (
minLocationRadius
) is set (this number would be in meters). If not, the default is 25 miles. - Run a generic vertical search to return all results (for example, run a search for the entity type) and check whether there are entities returned nearby, specifically within the radius found above.
- You can also check for entities in the platform. Navigate to Content > Entities and filter for the state/region or country name to find nearby locations.
- Navigate to Search > [[Experience Name]] > Edit as JSON. Check whether a minimum location radius (
- Check for experience training overrides: The desired inferred filter will not show up if it was rejected or another inferred filter was approved for the same search query.
- Navigate to Search > [[Experience Name]] > Inferred Filters.
- Use the search bar to filter to the search term you are troubleshooting.
- Click to turn on the toggle for “Show completed”.
- Check to see if there are any inferred filter entries for the relevant vertical.
- If a location inferred filter was rejected for the desired location, this inferred filter would not be applied for this search query. If you would like it to apply, undo the completed experience training override.
- If a different inferred filter was approved, a location inferred filter for the desired location will not be applied.
- Undo the incorrect filter.
- Toggle “Show completed” off.
- Approve the desired result by clicking the green checkmark next to it.
- If there are multiple active overrides, undo undesired ones so that there is only one active override.
I’m unable to find places outside of the United States
Place Search only searches the countries listed in countryRestrictions
. If this field is not populated, it defaults to search only in the United States.
- Navigate to Search > [[Experience Name]] > General Settings.
- Check that the
countryRestrictions
field is populated with the countries that you want included in the search and add any missing countries.
For more information, check out countryRestrictions
in the Answers Configuration API doc and the Additional Vertical Settings unit.
Location Search picked the wrong option between two identically-named places
Read about how the location search algorithm uses proximity bias and place prominence to choose between two identically-named places in the Search Algorithms reference doc.
Setting a bounding box and country restrictions will help to improve the accuracy of results by limiting the scope of the search to a particular region. Check the General Troubleshooting Steps above for how to do so.
I searched for a specific city, but locations from other cities are appearing or appearing higher
Location search works by finding the central latitude and longitude of the search token, for example, a city, and then returning the locations that are closest to that latitude and longitude. If locations from other cities are within the search radius, they’ll appear as well. There may be cases when locations in a different city are closer to the city center than locations in that city itself, and so they’ll appear higher in the results. For more details on the location search algorithm, check out the Search Algorithms reference article.
If you would like to filter to only show locations in the token searched, set an inferred filter for that address subfield, such as address.city
, which inferred filters treat as regular fields:
- Click Search in the navigation bar and click on the desired Search experience. You'll land on the Verticals screen.
- Select the vertical you want to add searchable fields to.
- On the Filters tab, find the box for Inferred Filters.
- Click + Add / Update Fields.
- In the search bar, type
address.
to view the possible address subfields and select the one you want to use. Then click Update Fields. - In the Searchable Fields table, turn on inferred Filter for the newly added field and turn it off for
builtin.location
if desired.
Comments
0 comments
Article is closed for comments.