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