mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 15:06:06 +00:00
use fulltext search in automplete
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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, '**')) {
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user