我想设置algolia来搜索Laravel中的多个索引,使用这样简单的东西。
{{1}}
但我也是laravel和algolia的初学者,所以我并不完全确定如何继续这样做。
答案 0 :(得分:1)
根据Algolia Docs州:
// perform 3 queries in a single API call:
// - 1st query targets index `categories`
// - 2nd and 3rd queries target index `products`
$queries = [
[
'indexName' => 'categories',
'query' => $myQueryString,
'hitsPerPage' => 3
],
[
'indexName' => 'products',
'query' => $myQueryString,
'hitsPerPage' => 3,
'facetFilters' => 'promotion'
],
[
'indexName' => 'products',
'query' => $myQueryString,
'hitsPerPage' => 10
]
];
$results = $client->multipleQueries($queries);
var_dump($results['results']);
不要忘记先初始化$client
:
$client = new \AlgoliaSearch\Client('APP_ID', 'APP_KEY');