Skip to content
Snippets Groups Projects
Commit c79a22a6 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Merge branch '405-base-parser-fehlt' into 'development'

Ich habe den base Parser jetzt theoretisch wieder eingefügt, konnte ihn allerdin…

Closes #405

See merge request !689
parents e5c6b68a 62ba0487
No related branches found
No related tags found
2 merge requests!697Development,!689Ich habe den base Parser jetzt theoretisch wieder eingefügt, konnte ihn allerdin…
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace app\Models\parserSkripte; namespace app\Models\parserSkripte;
use App\Models\Searchengine; use App\Models\Searchengine;
use Log;
class BASE extends Searchengine class BASE extends Searchengine
{ {
...@@ -15,6 +16,47 @@ class BASE extends Searchengine ...@@ -15,6 +16,47 @@ class BASE extends Searchengine
public function loadResults($result) public function loadResults($result)
{ {
return; $result = preg_replace("/\r\n/si", "", $result);
try {
$content = simplexml_load_string($result);
if (!$content) {
return;
}
$results = $content->xpath('//response/result');
foreach ($results as $result) {
// searches for the fitting values of name as in
// <str name = "dctitle">Digitisation of library collections</str>
foreach ($result as $attribute) {
switch ((string) $attribute['name']) {
case 'dctitle':
$title = $attribute;
break;
case 'dclink':
$link = $attribute;
$anzeigeLink = $link;
break;
case 'dcdescription':
$descr = $attribute;
break;
}
}
if (isset($title) && isset($link) && isset($anzeigeLink) && isset($descr)) {
$this->counter++;
$this->results[] = new \App\Models\Result(
$this->engine,
$title,
$link,
$anzeigeLink,
$descr,
$this->gefVon,
$this->counter
);
}
}
} catch (\Exception $e) {
Log::error("A problem occurred parsing results from $this->name");
return;
}
} }
} }
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