/**
  * @test
  * @param string $tableName
  * @param string $fieldName
  * @param string $likeValue
  * @param int $wildcard
  * @param string $expected
  * @dataProvider getLikeQueryPartDataProvider
  */
 public function getLikeQueryPart($tableName, $fieldName, $likeValue, $wildcard, $expected)
 {
     $subject = \TYPO3\CMS\IndexedSearch\Utility\LikeWildcard::cast($wildcard);
     $this->assertSame($expected, $subject->getLikeQueryPart($tableName, $fieldName, $likeValue));
 }
 /**
  * Search for a sentence
  *
  * @param string $sSentence Sentence to search for
  * @return bool|\mysqli_result SQL result pointer
  */
 public function searchSentence($sSentence)
 {
     $this->wSelClauses[] = '1=1';
     $likeWildcard = Utility\LikeWildcard::cast(Utility\LikeWildcard::BOTH);
     $likePart = $likeWildcard->getLikeQueryPart('index_fulltext', 'IFT.fulltextdata', $sSentence);
     return $this->databaseConnection->exec_SELECTquery('ISEC.phash', 'index_section ISEC, index_fulltext IFT', $likePart . ' AND ISEC.phash = IFT.phash' . $this->sectionTableWhere(), 'ISEC.phash');
 }
示例#3
0
 /**
  * Search for a sentence
  *
  * @param string $sWord the search word
  * @return Statement
  */
 protected function searchSentence($sWord)
 {
     $this->wSelClauses[] = '1=1';
     $likeWildcard = Utility\LikeWildcard::cast(Utility\LikeWildcard::BOTH);
     $likePart = $likeWildcard->getLikeQueryPart('index_fulltext', 'IFT.fulltextdata', $sWord);
     $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('index_section');
     return $queryBuilder->select('ISEC.phash')->from('index_section', 'ISEC')->from('index_fulltext', 'IFT')->where(QueryHelper::stripLogicalOperatorPrefix($likePart), $queryBuilder->expr()->eq('ISEC.phash', $queryBuilder->quoteIdentifier('IFT.phash')), QueryHelper::stripLogicalOperatorPrefix($this->sectionTableWhere()))->groupBy('ISEC.phash')->execute();
 }