Skip to content

Commit

Permalink
Soundex nur ausführen wenn nicht numerisch
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasKrais authored Nov 24, 2020
1 parent 4705486 commit ab7a4bb
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions lib/search_it.php
Original file line number Diff line number Diff line change
Expand Up @@ -2134,7 +2134,7 @@ function search($_search)
$simwordQuerys = [];
foreach ($this->searchArray as $keyword) {
$sounds = [];
if ($this->similarwordsMode & SEARCH_IT_SIMILARWORDS_SOUNDEX) {
if ($this->similarwordsMode & SEARCH_IT_SIMILARWORDS_SOUNDEX && !is_numeric(soundex($keyword['search']))) {
$sounds[] = "soundex = '" . soundex($keyword['search']) . "'";
}

Expand All @@ -2145,20 +2145,22 @@ function search($_search)
if ($this->similarwordsMode & SEARCH_IT_SIMILARWORDS_COLOGNEPHONE) {
$sounds[] = "colognephone = '" . soundex_ger($keyword['search']) . "'";
}
$simwordQuerys[] = sprintf("
(SELECT
GROUP_CONCAT(DISTINCT keyword SEPARATOR ' ') as keyword,
%s AS typedin,
SUM(count) as count
FROM `%s`
WHERE 1
%s
AND (%s))",
$simWordsSQL->escape($keyword['search']),
self::getTempTablePrefix() . 'search_it_keywords',
($this->clang !== false) ? 'AND (clang = ' . intval($this->clang) . ' OR clang IS NULL)' : '',
implode(' OR ', $sounds)
);
if(count($sounds) > 0) {
$simwordQuerys[] = sprintf("
(SELECT
GROUP_CONCAT(DISTINCT keyword SEPARATOR ' ') as keyword,
%s AS typedin,
SUM(count) as count
FROM `%s`
WHERE 1
%s
AND (%s))",
$simWordsSQL->escape($keyword['search']),
self::getTempTablePrefix() . 'search_it_keywords',
($this->clang !== false) ? 'AND (clang = ' . intval($this->clang) . ' OR clang IS NULL)' : '',
implode(' OR ', $sounds)
);
}
}
//echo '<br><pre>'; var_dump($simwordQuerys);echo '</pre>'; // Eine SQL-Abfrage pro Suchwort

Expand Down

0 comments on commit ab7a4bb

Please sign in to comment.