使用 Algolia 搜索特定属性(列)

searching in a specific attribute (column) with Algolia

我正在尝试利用 Algolia 的自然语言搜索在我已经填充的索引中进行搜索,但我只需要在 "name" 列中进行搜索。

我很难弄清楚该怎么做。我正在使用 PHP SDK,我已经设法对它进行分面,但是只有 returns facetHits,具有命中值,但我仍然需要模型中的数据.

你必须改变searchableAttributes

$index->setSettings([
  'searchableAttributes' => [
    'name',
  ]
]);

另见 the api reference and the guide for searchable attributes