From 32d71513691227277eaa447a10e3c560d8812fcc Mon Sep 17 00:00:00 2001 From: Furkan Akkoc Date: Mon, 11 Dec 2023 05:34:59 +0100 Subject: [PATCH] Optimized scout search with smart search --- src/QueryDataTable.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/QueryDataTable.php b/src/QueryDataTable.php index 8c3c5f05..b4beeafe 100644 --- a/src/QueryDataTable.php +++ b/src/QueryDataTable.php @@ -853,6 +853,23 @@ protected function globalSearch(string $keyword): void }); } + /** + * Perform multi-term search by splitting keyword into + * individual words and searches for each of them. + * + * @param string $keyword + * @return void + */ + protected function smartGlobalSearch($keyword): void + { + // Try scout search first & fall back to default search if disabled/failed + if ($this->applyScoutSearch($keyword)) { + return; + } + + parent::smartGlobalSearch($keyword); + } + /** * Append debug parameters on output. *