Skip to content
Snippets Groups Projects
Commit c58403df authored by Phil Höfer's avatar Phil Höfer
Browse files

Kürzen der Ergebnisse für API-Suchen entfernt.

parent 1bda7ace
No related branches found
No related tags found
1 merge request!1365Resolve "Filter Options for MetaGer"
...@@ -11,7 +11,8 @@ class Result ...@@ -11,7 +11,8 @@ class Result
public $titel; # Der Groß Angezeigte Name für das Suchergebnis public $titel; # Der Groß Angezeigte Name für das Suchergebnis
public $link; # Der Link auf die Ergebnisseite public $link; # Der Link auf die Ergebnisseite
public $anzeigeLink; # Der tatsächlich angezeigte Link (rein optisch) public $anzeigeLink; # Der tatsächlich angezeigte Link (rein optisch)
public $descr; # Die Beschreibung des Suchergebnisses public $descr; # Die eventuell gekürzte Beschreibung des Suchergebnisses
public $longDescr; # Die ungekürzte Beschreibung des Suchergebnisses
public $gefVon; # Das bei Suchergebnissen angezeigte von ... mitsamt Verlinkung public $gefVon; # Das bei Suchergebnissen angezeigte von ... mitsamt Verlinkung
public $sourceRank; # Das Ranking für dieses Suchergebnis von der Seite, die es geliefert hat (implizit durch Ergebnisreihenfolge: 20 - Position in Ergebnisliste) public $sourceRank; # Das Ranking für dieses Suchergebnis von der Seite, die es geliefert hat (implizit durch Ergebnisreihenfolge: 20 - Position in Ergebnisliste)
public $partnershop; # Ist das Ergebnis von einem Partnershop? (bool) public $partnershop; # Ist das Ergebnis von einem Partnershop? (bool)
...@@ -35,6 +36,7 @@ class Result ...@@ -35,6 +36,7 @@ class Result
$this->anzeigeLink = trim($anzeigeLink); $this->anzeigeLink = trim($anzeigeLink);
$this->descr = strip_tags(trim($descr), '<p>'); $this->descr = strip_tags(trim($descr), '<p>');
$this->descr = preg_replace("/\n+/si", " ", $this->descr); $this->descr = preg_replace("/\n+/si", " ", $this->descr);
$this->longDescr = $this->descr;
if (strlen($this->descr) > 250) { if (strlen($this->descr) > 250) {
$this->descr = wordwrap($this->descr, 250); $this->descr = wordwrap($this->descr, 250);
$this->descr = substr($this->descr, 0, strpos($this->descr, "\n")); $this->descr = substr($this->descr, 0, strpos($this->descr, "\n"));
...@@ -226,7 +228,7 @@ class Result ...@@ -226,7 +228,7 @@ class Result
# Eventueller Sprachfilter # Eventueller Sprachfilter
if ($metager->getLang() !== "all") { if ($metager->getLang() !== "all") {
if (!isset($this->langCode) || $this->langCode === NULL || $metager->getLang() !== $this->langCode) { if (!isset($this->langCode) || $this->langCode === null || $metager->getLang() !== $this->langCode) {
return false; return false;
} }
...@@ -244,11 +246,11 @@ class Result ...@@ -244,11 +246,11 @@ class Result
# Phrasensuche: # Phrasensuche:
$text = strtolower($this->titel) . " " . strtolower($this->descr); $text = strtolower($this->titel) . " " . strtolower($this->descr);
foreach ($metager->getPhrases() as $phrase) { foreach ($metager->getPhrases() as $phrase) {
if (strpos($text, $phrase) === false) { if (strpos($text, $phrase) === false) {
return false; return false;
}
} }
*/ }
*/
/* Der Host-Filter der sicherstellt, /* Der Host-Filter der sicherstellt,
* dass von jedem Host maximal 3 Links angezeigt werden. * dass von jedem Host maximal 3 Links angezeigt werden.
* Diese Überprüfung führen wir unter bestimmten Bedingungen nicht durch. * Diese Überprüfung führen wir unter bestimmten Bedingungen nicht durch.
...@@ -315,26 +317,26 @@ class Result ...@@ -315,26 +317,26 @@ class Result
if (!$link) { if (!$link) {
return ""; return "";
} }
# Link to our new Proxy software: # Link to our new Proxy software:
$pw = md5(env('PROXY_PASSWORD') . $link); $pw = md5(env('PROXY_PASSWORD') . $link);
$proxyUrl = base64_encode(str_rot13($link)); $proxyUrl = base64_encode(str_rot13($link));
$proxyUrl = urlencode(str_replace("/", "<<SLASH>>", $proxyUrl)); $proxyUrl = urlencode(str_replace("/", "<<SLASH>>", $proxyUrl));
return "https://proxy.suma-ev.de/" . $pw . "/" . $proxyUrl; return "https://proxy.suma-ev.de/" . $pw . "/" . $proxyUrl;
/* /*
$tmp = $link; $tmp = $link;
$tmp = preg_replace("/\r?\n$/s", "", $tmp); $tmp = preg_replace("/\r?\n$/s", "", $tmp);
$tmp = str_replace("=", "=3d", $tmp); $tmp = str_replace("=", "=3d", $tmp);
$tmp = str_replace("?", "=3f", $tmp); $tmp = str_replace("?", "=3f", $tmp);
$tmp = str_replace("%", "=25", $tmp); $tmp = str_replace("%", "=25", $tmp);
$tmp = str_replace("&", "=26", $tmp); $tmp = str_replace("&", "=26", $tmp);
$tmp = str_replace(";", "=3b", $tmp); $tmp = str_replace(";", "=3b", $tmp);
$tmp = preg_replace("#^([\w+.-]+)://#s", "$1/", $tmp); $tmp = preg_replace("#^([\w+.-]+)://#s", "$1/", $tmp);
$tmp = str_replace("//", "/=2f", $tmp); $tmp = str_replace("//", "/=2f", $tmp);
return "https://proxy.suma-ev.de/mger/nph-proxy.cgi/en/w0/" . $tmp; return "https://proxy.suma-ev.de/mger/nph-proxy.cgi/en/w0/" . $tmp;
*/ */
} }
/* Liest aus einer URL alle Informationen aus /* Liest aus einer URL alle Informationen aus
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<link>{!! htmlspecialchars($result->link, ENT_XML1, 'UTF-8'); !!}</link> <link>{!! htmlspecialchars($result->link, ENT_XML1, 'UTF-8'); !!}</link>
<mg:anzeigeLink>{!! htmlspecialchars($result->anzeigeLink, ENT_XML1, 'UTF-8'); !!}</mg:anzeigeLink> <mg:anzeigeLink>{!! htmlspecialchars($result->anzeigeLink, ENT_XML1, 'UTF-8'); !!}</mg:anzeigeLink>
<description> <description>
{!! htmlspecialchars($result->descr, ENT_XML1, 'UTF-8'); !!} {!! htmlspecialchars($result->longDescr, ENT_XML1, 'UTF-8'); !!}
</description> </description>
</item> </item>
@endforeach @endforeach
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment