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

Merge branch 'development' into 'master'

Development



See merge request !317
parents 95e10556 133148f2
...@@ -32,7 +32,7 @@ class MetaGer ...@@ -32,7 +32,7 @@ class MetaGer
protected $warnings = []; protected $warnings = [];
protected $errors = []; protected $errors = [];
protected $addedHosts = []; protected $addedHosts = [];
protected $startCount = 0; protected $startCount = 0;
# Daten über die Abfrage # Daten über die Abfrage
protected $ip; protected $ip;
protected $language; protected $language;
...@@ -223,15 +223,20 @@ class MetaGer ...@@ -223,15 +223,20 @@ class MetaGer
} }
$this->results = $newResults; $this->results = $newResults;
# Boost implementation
$this->results = $this->parseBoost($this->results);
#Adgoal Implementation
$this->results = $this->parseAdgoal($this->results);
$counter = 0; $counter = 0;
$firstRank = 0; $firstRank = 0;
if(isset($this->startForwards)) if (isset($this->startForwards)) {
{
$this->startCount = $this->startForwards; $this->startCount = $this->startForwards;
}elseif (isset($this->startBackwards)) { } elseif (isset($this->startBackwards)) {
$this->startCount = $this->startBackwards - count($this->results) - 1; $this->startCount = $this->startBackwards - count($this->results) - 1;
}else{ } else {
$this->startCount = 0; $this->startCount = 0;
} }
...@@ -282,24 +287,22 @@ class MetaGer ...@@ -282,24 +287,22 @@ class MetaGer
$this->errors[] = "Leider konnten wir zu Ihrer Sucheingabe keine passenden Ergebnisse finden."; $this->errors[] = "Leider konnten wir zu Ihrer Sucheingabe keine passenden Ergebnisse finden.";
} }
if( isset($this->last) && count($this->last) > 0 ) if (isset($this->last) && count($this->last) > 0) {
{ $page = $this->page - 1;
$page = $this->page - 1;
$this->last = [ $this->last = [
'page' => $page, 'page' => $page,
'startBackwards' => $this->results[0]->number, 'startBackwards' => $this->results[0]->number,
'engines' => $this->last, 'engines' => $this->last,
]; ];
Cache::put(md5(serialize($this->last)), serialize($this->last), 60); Cache::put(md5(serialize($this->last)), serialize($this->last), 60);
} }
if( isset($this->next) && count($this->next) > 0 && count($this->results) > 0) if (isset($this->next) && count($this->next) > 0 && count($this->results) > 0) {
{ $page = $this->page + 1;
$page = $this->page + 1;
$this->next = [ $this->next = [
'page' => $page, 'page' => $page,
'startForwards' => $this->results[count($this->results)-1]->number, 'startForwards' => $this->results[count($this->results) - 1]->number,
'engines' => $this->next, 'engines' => $this->next,
]; ];
Cache::put(md5(serialize($this->next)), serialize($this->next), 60); Cache::put(md5(serialize($this->next)), serialize($this->next), 60);
} }
...@@ -495,14 +498,18 @@ class MetaGer ...@@ -495,14 +498,18 @@ class MetaGer
$typeslist = []; $typeslist = [];
$counter = 0; $counter = 0;
if ($request->has('next') && Cache::has($request->input('next')) && unserialize(Cache::get($request->input('next')))['page'] > 1 ) { if ($request->has('next') && Cache::has($request->input('next')) && unserialize(Cache::get($request->input('next')))['page'] > 1) {
$next = unserialize(Cache::get($request->input('next'))); $next = unserialize(Cache::get($request->input('next')));
$this->page = $next['page']; $this->page = $next['page'];
$engines = $next['engines']; $engines = $next['engines'];
if(isset($next['startForwards'])) if (isset($next['startForwards'])) {
$this->startForwards = $next['startForwards']; $this->startForwards = $next['startForwards'];
if(isset($next['startBackwards'])) }
if (isset($next['startBackwards'])) {
$this->startBackwards = $next['startBackwards']; $this->startBackwards = $next['startBackwards'];
}
} else { } else {
foreach ($enabledSearchengines as $engine) { foreach ($enabledSearchengines as $engine) {
...@@ -1046,11 +1053,11 @@ class MetaGer ...@@ -1046,11 +1053,11 @@ class MetaGer
public function lastSearchLink() public function lastSearchLink()
{ {
if( isset($this->last) && count($this->last['engines']) > 0){ if (isset($this->last) && count($this->last['engines']) > 0) {
$requestData = $this->request->except(['page', 'out']); $requestData = $this->request->except(['page', 'out']);
$requestData['next'] = md5(serialize($this->last)); $requestData['next'] = md5(serialize($this->last));
$link = action('MetaGerSearch@search', $requestData); $link = action('MetaGerSearch@search', $requestData);
}else{ } else {
$link = "#"; $link = "#";
} }
return $link; return $link;
...@@ -1058,11 +1065,11 @@ class MetaGer ...@@ -1058,11 +1065,11 @@ class MetaGer
public function nextSearchLink() public function nextSearchLink()
{ {
if( isset($this->next) && count($this->next['engines']) > 0){ if (isset($this->next) && count($this->next['engines']) > 0) {
$requestData = $this->request->except(['page', 'out']); $requestData = $this->request->except(['page', 'out']);
$requestData['next'] = md5(serialize($this->next)); $requestData['next'] = md5(serialize($this->next));
$link = action('MetaGerSearch@search', $requestData); $link = action('MetaGerSearch@search', $requestData);
}else{ } else {
$link = "#"; $link = "#";
} }
return $link; return $link;
......
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