Skip to content
Snippets Groups Projects
Commit 343dafb8 authored by Davide Aprea's avatar Davide Aprea
Browse files

add pagination for dummy

parent 74bf09da
No related branches found
No related tags found
3 merge requests!1895Development,!1775Development,!1765Resolve "add dummy-engine to docker installation"
......@@ -40,7 +40,9 @@ class Dummy extends Searchengine
$this->counter
);
} catch (\ErrorException $e) {
Log::error("A problem occurred parsing results from $this->name:");
Log::error($e->getMessage());
return;
}
}
} catch (\Exception $e) {
......@@ -49,4 +51,42 @@ class Dummy extends Searchengine
return;
}
}
public function getNext(\App\MetaGer $metager, $result)
{
try {
$results = json_decode($result);
$newEngine = unserialize(serialize($this->engine));
$perPage = 0;
if(isset($newEngine->{"get-parameter"}->count)){
$perPage = $newEngine->{"get-parameter"}->count;
} else {
$perPage = 10;
}
$offset = 0;
if(empty($newEngine->{"get-parameter"}->skip)){
$offset = $perPage;
} else {
$offset = $newEngine->{"get-parameter"}->skip + $perPage;
}
if (PHP_INT_MAX - $perPage < ($offset + $perPage)) {
return;
} else {
$newEngine->{"get-parameter"}->skip = $offset;
}
$next = new Dummy($this->name, $newEngine, $metager);
$this->next = $next;
} catch (\Exception $e) {
Log::error("A problem occurred parsing results from $this->name:");
Log::error($e->getMessage());
return;
}
}
}
\ No newline at end of file
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