We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 392dd65 commit c3ce55bCopy full SHA for c3ce55b
src/Engines/TNTSearchEngine.php
@@ -6,6 +6,7 @@
6
use Laravel\Scout\Builder;
7
use Laravel\Scout\Engines\Engine;
8
use TeamTNT\TNTSearch\TNTSearch;
9
+use TeamTNT\TNTSearch\Exceptions\IndexNotFoundException;
10
11
class TNTSearchEngine extends Engine
12
{
@@ -81,7 +82,11 @@ public function delete($models)
81
82
*/
83
public function search(Builder $builder)
84
- return $this->performSearch($builder);
85
+ try {
86
+ return $this->performSearch($builder);
87
+ } catch (IndexNotFoundException $e) {
88
+ $this->initIndex($builder->model);
89
+ }
90
}
91
92
/**
@@ -209,4 +214,4 @@ public function initIndex($model)
209
214
$indexer->setPrimaryKey($model->getKeyName());
210
215
211
216
212
-}
217
+}
0 commit comments