Answer the question
In order to leave comments, you need to log in
Why search through algolia does not work in laravel?
Please explain how this can be, the site works correctly, it does not give any errors to the console, but at the same time it writes that it cannot find what it is obliged to find by definition? Since everything is logically spelled out and there are no jambs, or I don’t see them. It works through the algolia server, all accesses are registered correctly, when new material is loaded, they automatically get there, searchtables are also correct (search by name and description), but something goes wrong. Please help me how to fix the search?
Controller:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\{Channel, Video};
class SearchController extends Controller
{
public function index(Request $request)
{
if (!$request->q) {
return redirect('/');
}
$channels = Channel::search($request->q)->take(2)->get();
$videos = Video::search($request->q)->where('visible', true)->get();
return view('search.index', compact('channels', 'videos'));
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question