Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F6798461
benchScroll-wmf.16.php
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
EBernhardson
Mar 21 2017, 1:36 AM
2017-03-21 01:36:40 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
benchScroll-wmf.16.php
View Options
#
<?php
$config
=
MediaWiki\MediaWikiServices
::
getInstance
()->
getConfigFactory
()->
makeConfig
(
'CirrusSearch'
);
$conn
=
CirrusSearch\Connection
::
getPool
(
$config
,
'codfw'
);
$scorer
=
CirrusSearch\BuildDocument\Completion\SuggestScoringMethodFactory
::
getScoringMethod
(
'popqual'
);
$builder
=
new
CirrusSearch\BuildDocument\Completion\SuggestBuilder
(
$scorer
,
[]
);
$sourceIndex
=
$conn
->
getIndex
(
'cawiki'
,
'content'
);
$query
=
new
\Elastica\Query
();
$query
->
setSource
([
'includes'
=>
$builder
->
getRequiredFields
()]);
$pageAndNs
=
new
\Elastica\Query\BoolQuery
();
$pageAndNs
->
addShould
(
new
Elastica\Query\Term
([
"namespace"
=>
NS_MAIN
]));
$pageAndNs
->
addShould
(
new
Elastica\Query\Term
([
"redirect.namespace"
=>
NS_MAIN
]));
$pageAndNs
->
addMust
(
new
\Elastica\Query\Type
(
'page'
));
$bool
=
new
Elastica\Query\BoolQuery
();
$bool
->
addFilter
(
$pageAndNs
);
$query
->
setQuery
(
$bool
);
$search
=
new
\Elastica\Search
(
$conn
->
getClient
()
);
$search
->
setQuery
(
$query
);
$search
->
addIndex
(
$sourceIndex
);
$query
->
setSize
(
100
);
$scroll
=
new
\Elastica\Scroll
(
$search
,
'15m'
);
$esTook
=
0
;
$numDocs
=
0
;
$numBatches
=
0
;
$start
=
microtime
(
true
);
foreach
(
$scroll
as
$results
)
{
echo
"."
;
$esTook
+=
$results
->
getTotalTime
();
$numDocs
+=
count
(
$results
);
$numBatches
++;
}
$took
=
microtime
(
true
)
-
$start
;
echo
"IP: $IP
\n
"
;
echo
"Took: $took
\n
"
;
echo
"Elastic took: $esTook
\n
"
;
echo
"Docs seen: $numDocs
\n
"
;
echo
"Num batches: $numBatch
\n
"
;
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4489512
Default Alt Text
benchScroll-wmf.16.php (1 KB)
Attached To
Mode
P5093 benchScroll-wmf.16.php
Attached
Detach File
Event Timeline
Log In to Comment