request->getQuery('q');
$indexer = new \App\Library\Indexer\Course();
$courses = $indexer->search($query);
echo "total: {$courses['total']}
";
echo "
";
foreach ($courses['items'] as $course) {
echo "title:{$course->title}
";
echo "summary:{$course->summary}
";
echo "tags:{$course->tags}
";
echo "
";
}
exit;
}
/**
* @Get("/course/update", name="home.search.update_course")
*/
public function updateCourseAction()
{
$indexer = new \App\Library\Indexer\Course();
$courseRepo = new \App\Repos\Course();
$course = $courseRepo->findById(1);
$indexer->updateIndex($course);
echo "update ok";
exit;
}
/**
* @Get("/course/create", name="home.search.create_course")
*/
public function createCourseAction()
{
$indexer = new \App\Library\Indexer\Course();
$courseRepo = new \App\Repos\Course();
$course = $courseRepo->findById(1);
$indexer->addIndex($course);
echo "create ok";
exit;
}
/**
* @Get("/course/delete", name="home.search.delete_course")
*/
public function deleteCourseAction()
{
$indexer = new \App\Library\Indexer\Course();
$courseRepo = new \App\Repos\Course();
$course = $courseRepo->findById(1);
$indexer->deleteIndex($course);
echo "delete ok";
exit;
}
}