Search doesn't display results
geosem42 opened this issue · comments
George commented
I just changed the design and reverted back to default bootstrap. I haven't changed anything else other than the views. It looks like everything is working, from comments, blog posts, approving comments... except the search.
If I search for Post 1
I get a blue notification saying Posts found with search Post 1
but it displays no results. If I search for jdfghgh
I get the same thing.
bestmomo commented
"Post 1" is not in content. Did you try some word like "tempus" ?
George commented
Oooohhh, it indexes the content only.
Yes, it's working now. How do I add the title to be also searchable?
bestmomo commented
The query is in BlogRepository :
/**
* Get search collection.
*
* @param int $n
* @param string $search
* @return Illuminate\Support\Collection
*/
public function search($n, $search)
{
$query = $this->queryActiveWithUserOrderByDate();
return $query->where(function($q) use ($search) {
$q->where('summary', 'like', "%$search%")
->orWhere('content', 'like', "%$search%");
})->paginate($n);
}
You can add title there.