Hi all, I'm trying to implement a full text search for my site, but I have some problem with the QueryBuilder.
That's my search function:
<?php
protected function search($language, $q = null, $params)
{
$builder = new QueryBuilder();
$builder->columns([
"id",
"itemId",
"title",
"permalink" => sprintf("CONCAT('//%s/%s/',slug)", $_SERVER['HTTP_HOST'], $language, $language)
])
->from("App\Models\Ingested")
->where(
"language=:language: AND MATCH(searchable) AGAINST (:q: IN BOOLEAN MODE)",
[
"language" => $language,
"q" => $q."*",
]
);
$paginator = new PQueryBuilder(
[
"builder" => $builder,
"limit" => $params['limit'],
"page" => $params['page'],
]
);
return $paginator->getPaginate();
}
This return me an error:
Syntax error, unexpected token IDENTIFIER(BOOLEAN), near to ' MODE) LIMIT :APL0:', when parsing: SELECT id, itemId, title, CONCAT('//www.weekendinitaly.lo/it/',slug) AS [permalink] FROM [App\Models\Wizardry] WHERE language=:language: AND MATCH(searchable) AGAINST (:q: IN BOOLEAN MODE) LIMIT :APL0: (201)
#0 [internal function]: Phalcon\Mvc\Model\Query->parse()
#1 [internal function]: Phalcon\Mvc\Model\Query->execute()
#2 /var/www/BraveNewSystem/app/api/controllers/WizardryController.php(78): Phalcon\Paginator\Adapter\QueryBuilder->getPaginate()
#3 /var/www/BraveNewSystem/app/api/controllers/WizardryController.php(35): App\Api\Controllers\WizardryController->search('it', 'firen', Array)
Maybe it's a bug, isn't it?