Reputation: 666
For a ruby on rails app, I'm using Algolia place for a search bar. I need to search for place with city AND country. As per the documentation, I see that it's possible to search using type: 'city'
or type: 'country'
, but is it possible to search for both city and country at the same time?
Upvotes: 3
Views: 507
Reputation: 121
This is a current limitation of Algolia Places; You can't add multiple types (see Github issue). However, we are currently working on a fix to enable any mix of types.
In the meantime, you can do it by sending two search queries, one for each type and combine the results. Or, in your case, you could make use of multi datasets in Places. I've create a fiddle to see it in action: https://jsfiddle.net/RaphiD/z0t36t7o/
// Multi query datasets with Places
// [...]
var autocompleteInstance = autocomplete(document.querySelector('#autocomplete-dataset'), {
hint: false,
debug: true,
cssClasses: {prefix: 'ad-example'}
}, [
placesCountriesDataset,
placesCitiesDataset
]);
Upvotes: 2