Commit 279acbb0 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

fixed a bug in the new phrase search

parent 64f791ad
...@@ -285,8 +285,8 @@ class MetaGer ...@@ -285,8 +285,8 @@ class MetaGer
$newResults = []; $newResults = [];
foreach ($this->ads as $ad) { foreach ($this->ads as $ad) {
if (($ad->strippedHost !== "" && (in_array($ad->strippedHost, $this->adDomainsBlacklisted) || if (($ad->strippedHost !== "" && (in_array($ad->strippedHost, $this->adDomainsBlacklisted) ||
in_array($ad->strippedLink, $this->adUrlsBlacklisted))) || ($ad->strippedHostAnzeige !== "" && (in_array($ad->strippedHostAnzeige, $this->adDomainsBlacklisted) || in_array($ad->strippedLink, $this->adUrlsBlacklisted))) || ($ad->strippedHostAnzeige !== "" && (in_array($ad->strippedHostAnzeige, $this->adDomainsBlacklisted) ||
in_array($ad->strippedLinkAnzeige, $this->adUrlsBlacklisted))) in_array($ad->strippedLinkAnzeige, $this->adUrlsBlacklisted)))
) { ) {
continue; continue;
} }
...@@ -566,7 +566,7 @@ class MetaGer ...@@ -566,7 +566,7 @@ class MetaGer
$filter = rtrim($filter, ","); $filter = rtrim($filter, ",");
$error = trans('metaGer.engines.noSpecialSearch', [ $error = trans('metaGer.engines.noSpecialSearch', [
'fokus' => trans($this->sumaFile->foki->{$this->fokus}->{"display-name"}), 'fokus' => trans($this->sumaFile->foki->{$this->fokus}->{"display-name"}),
'filter' => $filter 'filter' => $filter,
]); ]);
$this->errors[] = $error; $this->errors[] = $error;
} }
...@@ -743,31 +743,31 @@ class MetaGer ...@@ -743,31 +743,31 @@ class MetaGer
public function sumaIsDisabled($suma) public function sumaIsDisabled($suma)
{ {
return return
isset($suma['disabled']) isset($suma['disabled'])
&& $suma['disabled']->__toString() === "1"; && $suma['disabled']->__toString() === "1";
} }
public function sumaIsOverture($suma) public function sumaIsOverture($suma)
{ {
return return
$suma["name"]->__toString() === "overture" $suma["name"]->__toString() === "overture"
|| $suma["name"]->__toString() === "overtureAds"; || $suma["name"]->__toString() === "overtureAds";
} }
public function sumaIsNotAdsuche($suma) public function sumaIsNotAdsuche($suma)
{ {
return return
$suma["name"]->__toString() !== "qualigo" $suma["name"]->__toString() !== "qualigo"
&& $suma["name"]->__toString() !== "similar_product_ads" && $suma["name"]->__toString() !== "similar_product_ads"
&& $suma["name"]->__toString() !== "overtureAds"; && $suma["name"]->__toString() !== "overtureAds";
} }
public function requestIsCached($request) public function requestIsCached($request)
{ {
return return
$request->filled('next') $request->filled('next')
&& Cache::has($request->input('next')) && Cache::has($request->input('next'))
&& unserialize(Cache::get($request->input('next')))['page'] > 1; && unserialize(Cache::get($request->input('next')))['page'] > 1;
} }
public function getCachedEngines($request) public function getCachedEngines($request)
...@@ -863,8 +863,8 @@ class MetaGer ...@@ -863,8 +863,8 @@ class MetaGer
} }
/* /*
* Ende Suchmaschinenerstellung und Ergebniserhalt * Ende Suchmaschinenerstellung und Ergebniserhalt
*/ */
public function parseFormData(Request $request) public function parseFormData(Request $request)
{ {
...@@ -1093,7 +1093,7 @@ class MetaGer ...@@ -1093,7 +1093,7 @@ class MetaGer
if (($request->filled($filter->{"get-parameter"}) && $request->input($filter->{"get-parameter"}) !== "off") || if (($request->filled($filter->{"get-parameter"}) && $request->input($filter->{"get-parameter"}) !== "off") ||
\Cookie::get($this->getFokus() . "_setting_" . $filter->{"get-parameter"}) !== null \Cookie::get($this->getFokus() . "_setting_" . $filter->{"get-parameter"}) !== null
) { # If the filter is set via Cookie ) { # If the filter is set via Cookie
$this->parameterFilter[$filterName] = $filter; $this->parameterFilter[$filterName] = $filter;
$this->parameterFilter[$filterName]->value = $request->input($filter->{"get-parameter"}, ''); $this->parameterFilter[$filterName]->value = $request->input($filter->{"get-parameter"}, '');
if (empty($this->parameterFilter[$filterName]->value)) { if (empty($this->parameterFilter[$filterName]->value)) {
$this->parameterFilter[$filterName]->value = \Cookie::get($this->getFokus() . "_setting_" . $filter->{"get-parameter"}); $this->parameterFilter[$filterName]->value = \Cookie::get($this->getFokus() . "_setting_" . $filter->{"get-parameter"});
...@@ -1227,14 +1227,14 @@ class MetaGer ...@@ -1227,14 +1227,14 @@ class MetaGer
// matches '[... ]-test[ ...]' // matches '[... ]-test[ ...]'
$words = preg_split("/\s+/si", $tmp); $words = preg_split("/\s+/si", $tmp);
$newQ = ""; $newQ = $this->q;
foreach ($words as $word) { foreach ($words as $word) {
if (strpos($word, "-") === 0 && strlen($word) > 1) { if (strpos($word, "-") === 0 && strlen($word) > 1) {
$this->stopWords[] = substr($word, 1); $this->stopWords[] = substr($word, 1);
} else { $newQ = str_ireplace($word, "", $newQ);
$newQ .= " " . $word;
} }
} }
$newQ = preg_replace("/(\s)\s+/", "$1", $newQ);
$this->q = trim($newQ); $this->q = trim($newQ);
# Overwrite Setting if submitted via Parameter # Overwrite Setting if submitted via Parameter
if ($request->has('stop')) { if ($request->has('stop')) {
......
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