Commit a21f84a4 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

added possibility to remove description from results

parent c5f81451
......@@ -66,6 +66,7 @@ class MetaGer
protected $adDomainsBlacklisted = [];
protected $urlsBlacklisted = [];
protected $adUrlsBlacklisted = [];
protected $blacklistDescriptionUrl = [];
protected $url;
protected $fullUrl;
protected $enabledSearchengines = [];
......@@ -103,6 +104,11 @@ class MetaGer
$this->adUrlsBlacklisted = explode("\n", $tmp);
}
if(file_exists(config_path() . "/blacklistDescriptionUrl.txt")){
$tmp = file_get_contents(config_path() . "/blacklistDescriptionUrl.txt");
$this->blacklistDescriptionUrl = explode("\n", $tmp);
}
# Parser Skripte einhängen
$dir = app_path() . "/Models/parserSkripte/";
foreach (scandir($dir) as $filename) {
......@@ -1831,6 +1837,11 @@ class MetaGer
return $this->domainsBlacklisted;
}
public function getBlacklistDescriptionUrl()
{
return $this->blacklistDescriptionUrl;
}
public function getUrlBlacklist()
{
return $this->urlsBlacklisted;
......
......@@ -269,6 +269,11 @@ class Result
}
}
// Possibly remove description
if($this->isDescriptionBlackListed($metager)){
$this->descr = "";
}
/*
# Phrasensuche:
$text = strtolower($this->titel) . " " . strtolower($this->descr);
......@@ -324,6 +329,11 @@ class Result
}
public function isDescriptionBlackListed(\App\MetaGer $metager)
{
return in_array($this->strippedLink, $metager->getBlacklistDescriptionUrl()) || in_array($this->strippedLinkAnzeige, $metager->getBlacklistDescriptionUrl());
}
/* Liest aus einem Link den Host.
* Dieser wird dabei in die Form:
* "http://www.foo.bar.de/test?ja=1" -> "foo.bar.de"
......
......@@ -121,6 +121,10 @@ spec:
mountPath: /html/config/adBlacklistUrl.txt
subPath: adblacklisturl
readOnly: true
- name: secrets
mountPath: /html/config/blacklistDescriptionUrl.txt
subPath: blacklistDescriptionUrl
readOnly: true
- name: secrets
mountPath: /html/config/adBlacklistDomains.txt
subPath: adblacklistdomains
......
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