Commit e6aefdad authored by Aria's avatar Aria

only query parts which are not inside of phrase searches will be checked for stopwords

parent 15c8db31
......@@ -1098,6 +1098,7 @@ class MetaGer
$tmp = $match[1] . $match[3];
$this->phrases[] = $match[2];
}
foreach ($this->phrases as $phrase) {
$p .= "\"$phrase\", ";
}
......@@ -1197,8 +1198,16 @@ class MetaGer
private function searchCheckStopwords($request)
{
$oldQ = $this->q;
$tmp = $this->q;
// matches '[... ]"test satz"[ ...]'
// In order to avoid "finding" stopwords inside of phrase searches only strings outside of quotation marks should be checked
while (preg_match("/(^|.*?\s)\"(.+)\"(\s.*|$)/si", $tmp, $match)) {
$tmp = $match[1] . $match[3];
}
// matches '[... ]-test[ ...]'
$words = preg_split("/\s+/si", $this->q);
$words = preg_split("/\s+/si", $tmp);
$newQ = "";
foreach ($words as $word) {
if (strpos($word, "-") === 0 && strlen($word) > 1) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment