Whether Scout in laravel 5.3 or do a custom search?

- ElasticSearch
- Scout
- Homemade

Homemade tipo:
public function search(Request $request){
 $search_data = $request->input('searcher');
 if (isset($search_data) && !empty($search_data) )
{
 $products = DB::table('products');
 $results = $products->where('product_name', 'LIKE', '%'. $search_data .'%')
 ->orWhere('product_id', 'LIKE', '%'. $search_data .'%')
 ->orWhere('description', 'LIKE', '%'. $search_data .'%')
->get();
 return view('products/search')->with('results', $results);
}
}

Sorry no vote, I'll ask if so - what do you use, why? What would you recommend?

And that gash made, and then it turns out that it is better yuzal at the outset the Scout, a lot of time to lose, I want to know your recommendations.
July 2nd 19 at 18:22
3 answers
July 2nd 19 at 18:24
Solution
And again you missed. Scout is the only provider that offers a common API for interacting with various search engines. For the search engines (Elasticsearch, Sphinx, etc.) need to find the driver under Scout. For popular, I think, already written. If not - then you are free to implement it. Then you specify in the configuration the driver and the connection parameters to the search engine. And then use built-in methods SCout La search.

Example provider database, Email. queues in the same Laravel

PS Depends what you want from the search, and choose. For a simple project and homebrew will work, just make it a bit smarter.
July 2nd 19 at 18:26
Scout is a common provider to interact with other services. It is possible to fasten the Elastic, Sphinx, TNT, etc.

If the project is small - forget. Better use the same Eloquence Searchable (Tyk)
July 2nd 19 at 18:28
As quoted above, Scout is the only provider that defines the search experience (Be it erlastic/lucene/sphinx or a third party service).
According to your example, I don't think You in fact, you should use an additional search engine.

Notice how you can implement Your method:

//Better to create a separate Request for search and passed it
//where the searcher is mandatory
public function search(Request $request)
{
 //To check the existence there is a special method
 if ($request->has('searcher')) {
 $results = $product->whereRaw(
 "MATCH(product_name,product_id,description) AGAINST(? IN BOOLEAN MODE)",
[$request->searcher]

 //In mysql there is a standard fulltext search
 //I think it makes sense to use it (don't forget about indexes)
)->get();
 return view('products/search')->with('results', $results);
}
}

Find more questions by tags LaravelPHP