Closed mefenlon closed 1 year ago
So it may not reload, but give you the opportunity to specify some settings at the time of the search, as for example it is done at Angloia.
use Algolia\AlgoliaSearch\SearchIndex;
use App\Models\Order;
Order::search(
'Star Trek',
function (SearchIndex $algolia, string $query, array $options) {
$options['body']['query']['bool']['filter']['geo_distance'] = [
'distance' => '1000km',
'location' => ['lat' => 36, 'lon' => 111],
];
return $algolia->search($query, $options);
}
)->get();
I have a situation similar to #169 where I need to run a boolean search followed by a regular search. After programmatically changing the config, the settings were not being applied in the second search.
I may be mistaken about this, but it seems $tnt->loadConfig($config); is only run once in TNTSearchScoutServiceProvider boot(), so changing the config elsewhere never gets applied.