Here.com Places Autosuggest API分类过滤功能失效求助
Let’s break down why your education-facility (and even restaurant) filters aren’t working as expected, and how to fix them:
1. Verify the Correct Category Key Format
Here’s the thing: the Places API uses lowercase category keys (like education-facility) which matches what you’re using, but Autosuggest often responds better to more specific sub-categories instead of top-level ones. For education-related results, try school or university instead of the broad education-facility—these are more granular and tend to trigger targeted suggestions.
Double-check that you’re not using display names (like "Educational Facility")—those won’t work; stick to the machine-readable keys from the documentation.
2. Understand Autosuggest’s Filter Logic (It’s Not Strict!)
This is a common gotcha: the category parameter in Autosuggest is a bias, not a strict filter. The API still prioritizes popular/nearby results (like cities or regions) even if you specify a category, especially if your search term ("strathcona") strongly maps to those broader places.
If you need only results from your target category, switch to the Places Search API (/places/v1/discover/search endpoint) instead—it’s designed for precise filtered searches, whereas Autosuggest is built for fast, flexible suggestions.
3. Fix URL & Parameter Issues
First, make sure your URL uses plain & instead of & (while some clients handle this, it can cause parameter parsing errors). Here’s a cleaned-up test call to try with a specific sub-category:
https://places.cit.api.here.com/places/v1/autosuggest?app_id=YOUR_APP_ID&app_code=YOUR_APP_CODE&q=strathcona&at=53.631611,-113.323975&category=school
Also, confirm that the coordinates in at are near actual educational facilities—run a test without the category parameter first to see if any schools show up in the unfiltered results. If none appear, the issue might be that there aren’t relevant places near that location, not the filter itself.
4. Troubleshooting the Restaurant Filter
Same logic applies here: use specific sub-categories like restaurant (the correct key) or fast-food instead of relying on broader terms. If even that doesn’t work, test the Search API with the same category to rule out API key/permission issues.
Final Recommendation
For strict category filtering, the Places Search API is the better tool. If you need to stick with Autosuggest, pair the specific sub-category with the strictbounds parameter (set to true) to force results to stay within the area around your at coordinates—this reduces the chance of broader, off-category suggestions.
内容的提问来源于stack exchange,提问作者mikebridge

