EBernhardson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/320520

Change subject: Accept 'OK' status results from search engine
......................................................................

Accept 'OK' status results from search engine

Historically code that talks to the SearchEngine has been treating
anything other than a 'Good' result, such as results but with a warning
(perhaps the query timed out and only gave partial results) as a
complete failure. Adjust the handling to report results from an 'OK'
status response, while keeping the previous behavior of throwing away any
warnings.

Change-Id: I8b503ce79fc54ed9913e6e9a58cfe28f75516456
---
M SpecialProofreadPages.php
1 file changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ProofreadPage 
refs/changes/20/320520/1

diff --git a/SpecialProofreadPages.php b/SpecialProofreadPages.php
index eb275f7..2d27998 100644
--- a/SpecialProofreadPages.php
+++ b/SpecialProofreadPages.php
@@ -74,7 +74,15 @@
                                $searchEngine->setLimitOffset( $this->limit + 
1, $this->offset );
                                $searchEngine->setNamespaces( [ 
$indexNamespaceId ] );
                                $searchEngine->showRedirects = false;
-                               $textMatches = $searchEngine->searchText( 
$this->searchTerm );
+                               $status = $searchEngine->searchText( 
$this->searchTerm );
+                               if ( $status instanceof SearchResultSet ) {
+                                       $textMatches = $status;
+                                       $status = null;
+                               } elseif ( $status->isOK() ) {
+                                       $textMatches = $status->getValue();
+                               } else {
+                                       $textMatches = null;
+                               }
                                if ( !( $textMatches instanceof SearchResultSet 
) ) {
                                        // TODO: $searchEngine->searchText() 
can return status objects
                                        // Might want to extract some 
information from them

-- 
To view, visit https://gerrit.wikimedia.org/r/320520
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8b503ce79fc54ed9913e6e9a58cfe28f75516456
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ProofreadPage
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <ebernhard...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to