Prechádzať zdrojové kódy

Merge pull request #1810 from visuddhinanda/laravel

add log in search
visuddhinanda 2 rokov pred
rodič
commit
bd9c7a162f

+ 7 - 0
app/Http/Controllers/SearchController.php

@@ -190,6 +190,13 @@ class SearchController extends Controller
         $offset = $request->get('offset',0);
         $offset = $request->get('offset',0);
         $matchMode = $request->get('match','case');
         $matchMode = $request->get('match','case');
         $result = PaliSearch::search($key,$bookId,$matchMode,$offset,$limit);
         $result = PaliSearch::search($key,$bookId,$matchMode,$offset,$limit);
+        Log::debug('search tulip total='.$result['total'],[
+            'key'=>$request->get('key'),
+            'bookId'=>$bookId,
+            'matchMode'=>$matchMode,
+            'offset'=>$offset,
+            'limit'=>$limit,
+        ]);
         return $this->ok(["rows"=>SearchResource::collection(collect($result['rows'])),"count"=>$result['total']]);
         return $this->ok(["rows"=>SearchResource::collection(collect($result['rows'])),"count"=>$result['total']]);
     }
     }
 
 

+ 7 - 1
app/Tools/PaliSearch.php

@@ -14,8 +14,14 @@ class PaliSearch
         return $client;
         return $client;
     }
     }
     public static function search($words,$books,$matchMode='case',$index=0,$size=10){
     public static function search($words,$books,$matchMode='case',$index=0,$size=10){
+        Log::debug('tulip search',[
+            'words'=>$words,
+            'books'=>$books,
+            'matchMode'=>$matchMode,
+            'index'=>$index,
+            'size'=>$size,
+        ]);
         $client = PaliSearch::connect();
         $client = PaliSearch::connect();
-
         $request = new \Mint\Tulip\V1\SearchRequest();
         $request = new \Mint\Tulip\V1\SearchRequest();
         $request->setKeywords($words);
         $request->setKeywords($words);
         $request->setBooks($books);
         $request->setBooks($books);