normalize_for_search on words matched in the search
This commit is contained in:
parent
b223abb3ac
commit
b733893d92
5
base.php
5
base.php
|
@ -384,6 +384,7 @@ function matches_comparing_expression($expr, $text) {
|
|||
if (gettype($expr) === 'string')
|
||||
$expr = parse_comparing_expression($expr);
|
||||
$result = $expr['original'];
|
||||
$text_words = explode(' ', $text);
|
||||
foreach ($expr['parsed'] as $lvl => $exl) {
|
||||
foreach ($exl as &$t) {
|
||||
if (strpos($t, 'words ') === 0) {
|
||||
|
@ -391,7 +392,7 @@ function matches_comparing_expression($expr, $text) {
|
|||
$ws = explode(' ', trim(trim($w, '"')));
|
||||
$haveall = true;
|
||||
foreach ($ws as $w) {
|
||||
if (strpos($text, $w) === false) {
|
||||
if (!in_array(normalize_for_search($w), $text_words)) {
|
||||
$haveall = false;
|
||||
break;
|
||||
}
|
||||
|
@ -400,7 +401,7 @@ function matches_comparing_expression($expr, $text) {
|
|||
} else if (strpos($t, 'contains ') === 0) {
|
||||
$w = substr($t, strlen('contains')+1);
|
||||
$w = trim(trim($w, '"'));
|
||||
$contains = strpos($text, $w) !== false;
|
||||
$contains = strpos($text, normalize_for_search($w)) !== false;
|
||||
$result = str_replace($t, $contains ? 'true' : 'false', $result);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue