Commit f4f63f3a authored by Arnaud Bey's avatar Arnaud Bey
Browse files

remove fulltext index search

parent 573622c4
...@@ -53,7 +53,7 @@ class WordManager ...@@ -53,7 +53,7 @@ class WordManager
{ {
$languageId = $language->getId(); $languageId = $language->getId();
foreach ($wordStarts as $wordStartValue) { foreach ($wordStarts as $wordStartValue) {
if (!$found = $this->em->getRepository(WordStart::class)->search($wordStartValue, $languageId)) { if (!$found = $this->em->getRepository(WordStart::class)->findOneBy(["language" => $language, "value" => $wordStartValue])) {
$wordStart = new WordStart; $wordStart = new WordStart;
$wordStart->setLanguage($languageId); $wordStart->setLanguage($languageId);
$wordStart->setValue($wordStartValue); $wordStart->setValue($wordStartValue);
......
...@@ -9,20 +9,6 @@ use Symfony\Bridge\Doctrine\RegistryInterface; ...@@ -9,20 +9,6 @@ use Symfony\Bridge\Doctrine\RegistryInterface;
class WordStartRepository extends \Doctrine\ORM\EntityRepository class WordStartRepository extends \Doctrine\ORM\EntityRepository
{ {
public function search($start, $languageId)
{
$sql = "SELECT 1 FROM lexicon_word_start WHERE MATCH(value) AGAINST ('".$start."' IN NATURAL LANGUAGE MODE) AND language = ".$languageId;
$em = $this->_em;
$stmt = $em->getConnection()->prepare($sql);
$stmt->execute();
if (!empty($stmt->fetchAll())) {
return true;
};
return false;
}
public function deleteByLanguage($language) public function deleteByLanguage($language)
{ {
return $this->createQueryBuilder('ws') return $this->createQueryBuilder('ws')
...@@ -30,8 +16,7 @@ class WordStartRepository extends \Doctrine\ORM\EntityRepository ...@@ -30,8 +16,7 @@ class WordStartRepository extends \Doctrine\ORM\EntityRepository
->andWhere('ws.language = :val') ->andWhere('ws.language = :val')
->setParameter('val', $language) ->setParameter('val', $language)
->getQuery() ->getQuery()
->getResult() ->getResult();
;
} }
public function countAllByLanguage(Language $language) public function countAllByLanguage(Language $language)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment