EBernhardson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/250441
Change subject: Extend output of runSearch.php
......................................................................
Extend output of runSearch.php
Adds page id, title text and snippets information to give
relevance lab more information to work with
Bug: T116869
Change-Id: I5d5f872a7ef540bf16f973fa7f93925d957a16f7
---
M maintenance/runSearch.php
1 file changed, 27 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch
refs/changes/41/250441/1
diff --git a/maintenance/runSearch.php b/maintenance/runSearch.php
index 8618f4b..44a211a 100644
--- a/maintenance/runSearch.php
+++ b/maintenance/runSearch.php
@@ -103,9 +103,34 @@
if ( $status->isOK() ) {
$value = $status->getValue();
if ( $value instanceof ResultSet ) {
- $data['rows'] = $value->numRows();
+ // these are prefix or full text results
+ $data['totalHits'] = $value->getTotalHits();
+ $data['rows'] = array();
+ $result = $value->next();
+ while ( $result ) {
+ $data['rows'][] = array(
+ 'pageId' =>
$result->getTitle()->getArticleId(),
+ 'title' =>
$result->getTitle()->getPrefixedText(),
+ 'snippets' => array(
+ 'text' =>
$result->getTextSnippet( $query ),
+ 'title' =>
$result->getTitleSnippet(),
+ 'redirect' =>
$result->getRedirectSnippet(),
+ 'section' =>
$result->getSectionSnippet(),
+ 'category' =>
$result->getCategorySnippet(),
+ ),
+ );
+ $result = $value->next();
+ }
} elseif ( is_array ($value ) ) {
- $data['rows'] = count( $value );
+ // these are suggestion results
+ $data['totalHits'] = count( $value );
+ foreach ( $value as $row ) {
+ $data['rows'][] = array(
+ 'pageId' => $row['pageId'],
+ 'title' =>
$row['title']->getPrefixedText(),
+ 'snippets' => array(),
+ );
+ }
}
} else {
$data['error'] = $status->getMessage()->text();
--
To view, visit https://gerrit.wikimedia.org/r/250441
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5d5f872a7ef540bf16f973fa7f93925d957a16f7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits