use fulltext search in automplete

This commit is contained in:
Yuri Kuznetsov
2022-04-12 16:38:47 +03:00
parent 08f64eb209
commit 2f3f2a0247
3 changed files with 9 additions and 16 deletions

View File

@@ -385,11 +385,7 @@ class SearchParams
$rawParams['primaryFilter'] = $primaryFilter;
$rawParams['textFilter'] = $textFilter;
$rawParams['where'] = $where;
$rawParams['noFullTextSearch'] = false;
$rawParams['noFullTextSearch'] = isset($params['q']);
$rawParams['maxTextAttributeLength'] = $maxTextAttributeLength;
if ($where) {

View File

@@ -70,8 +70,7 @@ class FullTextSearchDataComposer
$useFullTextSearch = false;
if (
$this->metadataProvider->hasFullTextSearch($this->entityType)
&&
$this->metadataProvider->hasFullTextSearch($this->entityType) &&
!empty($fullTextSearchColumnList)
) {
$fullTextSearchMinLength = $this->config->get('fullTextSearchMinLength') ?? self::MIN_LENGTH;
@@ -80,11 +79,13 @@ class FullTextSearchDataComposer
$fullTextSearchMinLength = 0;
}
$filterWoWildcards = str_replace('*', '', $filter);
/*$filterWoWildcards = str_replace('*', '', $filter);
if (mb_strlen($filterWoWildcards) >= $fullTextSearchMinLength) {
$useFullTextSearch = true;
}
}*/
$useFullTextSearch = true;
}
$fullTextSearchFieldList = [];
@@ -140,12 +141,9 @@ class FullTextSearchDataComposer
if (
$isAuxiliaryUse && mb_strpos($filter, '*') === false
||
mb_strpos($filter, ' ') === false
&&
mb_strpos($filter, '+') === false
&&
mb_strpos($filter, '-') === false
&&
mb_strpos($filter, ' ') === false &&
mb_strpos($filter, '+') === false &&
mb_strpos($filter, '-') === false &&
mb_strpos($filter, '*') === false
) {
$function = 'MATCH_NATURAL_LANGUAGE';
@@ -156,7 +154,6 @@ class FullTextSearchDataComposer
$filter = str_replace('"*', '"', $filter);
$filter = str_replace('*"', '"', $filter);
$filter = str_replace('\'', '\'\'', $filter);
while (strpos($filter, '**')) {

View File

@@ -100,7 +100,7 @@ class SearchParamsTest extends \PHPUnit\Framework\TestCase
$this->assertEquals('test', $params->getTextFilter());
$this->assertTrue($params->noFullTextSearch());
$this->assertFalse($params->noFullTextSearch());
}
public function testOrder()