Physikerwelt has uploaded a new change for review.

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

Change subject: BaseX: Handle outdated index
......................................................................

BaseX: Handle outdated index

Prints a warning to the debug log, if elements from the index can
not be found in the database.

Change-Id: Iffebe9c7632daec7f87e8010f7805af1338d895c
---
M MathEngineBaseX.php
1 file changed, 10 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MathSearch 
refs/changes/80/178980/1

diff --git a/MathEngineBaseX.php b/MathEngineBaseX.php
index 6e64590..592ef4e 100644
--- a/MathEngineBaseX.php
+++ b/MathEngineBaseX.php
@@ -70,8 +70,16 @@
                        preg_match_all( $baseXRegExp , $res, 
$matches,PREG_SET_ORDER);
                        foreach($matches as $match){
                                $mo = 
MathObject::constructformpage($match[1],$match[2]);
-                               $this->relevanceMap[(string) 
$mo->getPageID()]=true;
-                               $this->resultSet[(string) 
$mo->getPageID()][(string) $mo->getAnchorID()][] = array( "xpath" => '/', 
"mappings" => array() ); // ,"original"=>$page->asXML()
+                               if ( $mo ) {
+                                       
$this->relevanceMap[(string)$mo->getPageID()] = true;
+                                       
$this->resultSet[(string)$mo->getPageID()][(string)$mo->getAnchorID()][] =
+                                               array(
+                                                       "xpath" => '/',
+                                                       "mappings" => array()
+                                               ); // 
,"original"=>$page->asXML()
+                               } else {
+                                       wfDebugLog( 'MathSearch', "Warning: 
Entry ${match[1]}, ${match[2]} not fund in database. Index might be out of 
date." );
+                               }
                        }
                } else {
                        $this->size = 0;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iffebe9c7632daec7f87e8010f7805af1338d895c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MathSearch
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt <w...@physikerwelt.de>

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

Reply via email to