Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

alexphm's avatar

Intermittent Nova 3 resource search results

Nova: v3.8.2 Laravel: 7

I'm having an issue with User resource search results, I have the following settings for search in App\Nova\User.php:

public static $search = [
    'email', 'lastname', 'firstname'
];

When searching for lastname of a user it brings up results as expected, but then searching for another users lastname I know is in the database it returns no results. It seems to fail intermittently and without reason.

For testing, I'm returning blank arrays for actions, lenses and filters. And for the fields I simply have the following (only for testing) same problem:

public function fields(Request $request)  
{  
	return [  
		ID::make('ID', 'id'),  
		Text::make('First name', 'firstname')->sortable()  
		->rules('required'),  
		Text::make('Last name', 'lastname')->sortable()  
		->rules('required'),  
	];
}

I'd imagine it may have something to do with my Users model, could anyone provide me with some insight into how the Nova search results are generated and what might block certain records from appearing.

0 likes
1 reply
alexphm's avatar
alexphm
OP
Best Answer
Level 1

After some research and further testing, I found out that Nova uses Laravel Scout by default for searching. I'd assumed incorrectly the default method was a direct search of the database. In our case, our Scout Algolia setup has is very specific for the frontend. For example, we don't include email for security. Also, our local testing Algolia setup has a limited set of records. This was causing intermittent search results when testing.

The best solution here is to setup Algolia correctly to support Nova. But as a quick solution we can disable Scout on a Nova resource level:

public static function usesScout()
{
    return false;
}

https://github.com/laravel/nova-issues/issues/1349

Laravel Nova: Bypass the search with Scout

Please or to participate in this conversation.