Commit 9c37d30d authored by Dominik Hebeler's avatar Dominik Hebeler

Fixed a bug in the Stopwords

parent 89d0e52c
......@@ -1213,11 +1213,18 @@ class MetaGer
private function searchCheckStopwords($request)
{
$oldQ = $this->q;
// matches '[... ]-test[ ...]'
while (preg_match("/(^|.*?\s)-(\S+)(\s.*|$)/si", $this->q, $match)) {
$this->stopWords[] = $match[2];
$this->q = $match[1] . $match[3];
$words = preg_split("/\s+/si",$this->q);
$newQ = "";
foreach($words as $word){
if(strpos($word, "-") === 0 && strlen($word) > 1){
$this->stopWords[] = substr($word, 1);
}else{
$newQ .= " " . $word;
}
}
$this->q = trim($newQ);
# Overwrite Setting if submitted via Parameter
if ($request->has('stop')) {
$this->stopWords = [];
......@@ -1231,6 +1238,7 @@ class MetaGer
} else {
$this->stopWords[] = $stop;
}
$this->q = $oldQ;
}
// print the stopwords as a user warning
if (sizeof($this->stopWords) > 0) {
......
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