Only getting local scout results, not Algolia index

Really dont understand what I am doing wrong. I am using the scout-extended plugin.

I have a Pages model with

public function toSearchableArray()
    $array = $this->toArray();
	$array = $this->transform($array);

	$array['parent_id'] = $this->book_id;
	$array['hub'] = null;
	$array['slug'] = null;
	$array['title'] = $this->name;
	$array['content'] = $this->text;

	return $array;

In CLI I can run

php artisan scout:import "App\Models\Pages"

And it pushes the data to Algolia index like it should.

Then on my test controller I try to fetch the results:

return Pages::search(‘test’)->get();

All I get are local scout results, like its searching my local database not the Algoilia data that I see in Algolia Dashboard. What am I doing wrong? Pushing data to the indexs is no issue.

I’m not sure what you mean by “local scout results” but I’ll try to clarify.

Scouts search in the algolia index, then selects only the objectIDs (primary key of the model) and loads those models from the database with something like Pages::whereIn('id', $objectsIDsFromAlgolia).

If you want to get the raw JSON response from Algolia, you can use Pages::search(‘test’)->raw();.

If you find that the results are not so relevant, please make sure you at least set searchableAttributes and customRanking in your Algolia settings.