Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P5094
benchScrollv2-wmf.16.php
Active
Public
Actions
Authored by
EBernhardson
on Mar 21 2017, 12:30 AM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F6797660: benchScrollv2-wmf.16.php
Mar 21 2017, 12:30 AM
2017-03-21 00:30:19 (UTC+0)
Subscribers
None
#
<?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
(
'enwiki'
,
'content'
);
$boolNot
=
new
Elastica\Query\BoolQuery
();
$boolNot
->
addMustNot
(
new
\Elastica\Query\Term
([
'batch_id'
=>
time
()]));
$bool
=
new
\Elastica\Query\BoolQuery
();
$bool
->
addFilter
(
$boolNot
);
$query
=
new
Elastica\Query
();
$query
->
setQuery
(
$bool
);
$query
->
setStoredFields
([
'_id'
]);
$search
=
new
\Elastica\Search
(
$conn
->
getClient
()
);
$search
->
setQuery
(
$query
);
$search
->
addIndex
(
$sourceIndex
);
$query
->
setSize
(
100
);
$scroll
=
new
\Elastica\Scroll
(
$search
,
'15m'
);
$start
=
microtime
(
true
);
foreach
(
$scroll
as
$results
)
{
echo
"."
;
}
$took
=
microtime
(
true
)
-
$start
;
var_dump
(
$took
);
Event Timeline
EBernhardson
created this paste.
Mar 21 2017, 12:30 AM
2017-03-21 00:30:19 (UTC+0)
Log In to Comment