要从Algolia自动完成建议中删除包含“行政”市/区的建议,您可以使用Algolia的代码示例中的以下方法:
var client = algoliasearch('YourApplicationID', 'YourAPIKey');
var index = client.initIndex('YourIndexName');
index.search({
query: 'query',
hitsPerPage: 10
}, function(err, content) {
if (err) throw err;
// Content contains the autocomplete suggestions
console.log(content.hits);
});
var filteredHits = content.hits.filter(function(hit) {
// Check if the suggestion contains the word "行政" or not
return hit.suggestion.indexOf('行政') === -1;
});
console.log(filteredHits);
这样,您将获得一个不包含“行政”市/区的自动完成建议列表。
请注意,上述示例代码中的'YourApplicationID','YourAPIKey'和'YourIndexName'需要替换为您自己的Algolia应用程序ID,API密钥和索引名称。
希望这可以帮助您解决问题!