Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
MetaGer
Commits
84b24a24
Commit
84b24a24
authored
Feb 06, 2020
by
Dominik Hebeler
Browse files
added more timings
parent
a6e0ab4e
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/MetaGerSearch.php
View file @
84b24a24
...
...
@@ -61,14 +61,11 @@ class MetaGerSearch extends Controller
# Suche für alle zu verwendenden Suchmaschinen als Job erstellen,
# auf Ergebnisse warten und die Ergebnisse laden
$metager
->
createSearchEngines
(
$request
);
if
(
!
empty
(
$timings
))
{
$timings
[
"createSearchEngines"
]
=
microtime
(
true
)
-
$time
;
}
$metager
->
createSearchEngines
(
$request
,
$timings
);
$metager
->
startSearch
();
if
(
!
empty
(
$timings
))
{
$timings
[
"
createSearchEngines
"
]
=
microtime
(
true
)
-
$time
;
$timings
[
"
startSearch
"
]
=
microtime
(
true
)
-
$time
;
}
$metager
->
waitForMainResults
();
...
...
app/MetaGer.php
View file @
84b24a24
...
...
@@ -473,8 +473,12 @@ class MetaGer
* Die Erstellung der Suchmaschinen bis die Ergebnisse da sind mit Unterfunktionen
*/
public
function
createSearchEngines
(
Request
$request
)
public
function
createSearchEngines
(
Request
$request
,
&
$timings
)
{
if
(
!
empty
(
$timings
))
{
$timings
[
"createSearchEngines"
][
"start"
]
=
microtime
(
true
)
-
$timings
[
"starttime"
];
}
# Wenn es kein Suchwort gibt
if
(
!
$request
->
filled
(
"eingabe"
)
||
$this
->
q
===
""
)
{
return
;
...
...
@@ -495,8 +499,16 @@ class MetaGer
$sumas
[
$sumaName
]
=
$this
->
sumaFile
->
sumas
->
{
$sumaName
};
}
if
(
!
empty
(
$timings
))
{
$timings
[
"createSearchEngines"
][
"created engine array"
]
=
microtime
(
true
)
-
$timings
[
"starttime"
];
}
$this
->
removeAdsFromListIfAdfree
(
$sumas
);
if
(
!
empty
(
$timings
))
{
$timings
[
"createSearchEngines"
][
"removed ads"
]
=
microtime
(
true
)
-
$timings
[
"starttime"
];
}
foreach
(
$sumas
as
$sumaName
=>
$suma
)
{
# Check if this engine is disabled and can't be used
$disabled
=
empty
(
$suma
->
disabled
)
?
false
:
$suma
->
disabled
;
...
...
@@ -550,6 +562,10 @@ class MetaGer
}
}
if
(
!
empty
(
$timings
))
{
$timings
[
"createSearchEngines"
][
"filtered invalid engines"
]
=
microtime
(
true
)
-
$timings
[
"starttime"
];
}
# Include Yahoo Ads if Yahoo is not enabled as a searchengine
if
(
!
$this
->
apiAuthorized
&&
$this
->
fokus
!=
"bilder"
&&
empty
(
$this
->
enabledSearchengines
[
"yahoo"
])
&&
isset
(
$this
->
sumaFile
->
sumas
->
{
"yahoo-ads"
}))
{
$this
->
enabledSearchengines
[
"yahoo-ads"
]
=
$this
->
sumaFile
->
sumas
->
{
"yahoo-ads"
};
...
...
@@ -574,6 +590,10 @@ class MetaGer
$this
->
errors
[]
=
$error
;
}
$this
->
setEngines
(
$request
);
if
(
!
empty
(
$timings
))
{
$timings
[
"createSearchEngines"
][
"saved engines"
]
=
microtime
(
true
)
-
$timings
[
"starttime"
];
}
}
private
function
removeAdsFromListIfAdfree
(
&
$sumas
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment