[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [FIX] console index rebuild: add ability to skip error tracking for large...

"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <693d66c1b9368_2a17f548-35e@gitlab-sidekiq-low-urgency-cpu-bound-v2-64d4768b4d-g6g4w.mail>

Victor Emanouilov pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki


Commits:
9df004ef by Victor Emanouilov at 2025-12-13T15:14:32+02:00
[FIX] console index rebuild: add ability to skip error tracking for large indexes where log file is enough

- - - - -


3 changed files:

- lib/core/Search/Indexer.php
- lib/core/Tiki/Command/IndexRebuildCommand.php
- lib/search/searchlib-unified.php


Changes:

=====================================
lib/core/Search/Indexer.php
=====================================
@@ -21,6 +21,7 @@ class Search_Indexer
     private $cacheGlobals = null;
     private $cacheTypes = [];
     private $cacheErrors = [];
+    private $errorTrackingEnabled = true;
     private $stats;
 
     private $contentFilters = [];
@@ -118,6 +119,11 @@ class Search_Indexer
         $this->contentFilters[] = $filter;
     }
 
+    public function setErrorTrackingEnabled($errorTrackingEnabled)
+    {
+        $this->errorTrackingEnabled = $errorTrackingEnabled;
+    }
+
     /**
      * Rebuild the entire index.
      *
@@ -232,7 +238,9 @@ class Search_Indexer
                     $e->getMessage()
                 );
                 Feedback::error($msg);
-                TikiLib::lib('errortracking')->captureException($e);
+                if ($this->errorTrackingEnabled) {
+                    TikiLib::lib('errortracking')->captureException($e);
+                }
             }
             foreach ($this->cacheErrors as $err) {
                 $this->log->error($err['error'] . ': ' . $err['errstr'], [
@@ -240,8 +248,10 @@ class Search_Indexer
                     'file' => $err['errfile'],
                     'line' => $err['errline'],
                 ]);
-                $e = new ErrorException($err['errstr'], 0, $err['errno'], $err['errfile'], $err['errline']);
-                TikiLib::lib('errortracking')->captureException($e);
+                if ($this->errorTrackingEnabled) {
+                    $e = new ErrorException($err['errstr'], 0, $err['errno'], $err['errfile'], $err['errline']);
+                    TikiLib::lib('errortracking')->captureException($e);
+                }
             }
             $this->cacheErrors = [];
             // log file display feedback messages after each document line to make it easier to track


=====================================
lib/core/Tiki/Command/IndexRebuildCommand.php
=====================================
@@ -42,6 +42,12 @@ class IndexRebuildCommand extends Command
                 'p',
                 InputOption::VALUE_NONE,
                 'Show progress bar'
+            )
+            ->addOption(
+                'skip-error-tracking',
+                null,
+                InputOption::VALUE_NONE,
+                'Skip Tiki error tracking and only log errors to log file (if enabled). Useful if you rebuild generates a lot of noise in your external error tracking system.'
             );
     }
 
@@ -135,7 +141,9 @@ class IndexRebuildCommand extends Command
             $progress = null;
         }
 
-        $result = $unifiedsearchlib->rebuild($log, false, $progress);
+        $skipErrorTracking = $input->getOption('skip-error-tracking') ? true : false;
+
+        $result = $unifiedsearchlib->rebuild($log, false, $progress, $skipErrorTracking);
 
         if ($progress) {
             $progress->setMessage(tr('Rebuilding preferences index'));


=====================================
lib/search/searchlib-unified.php
=====================================
@@ -169,7 +169,7 @@ class UnifiedSearchLib
      * @return array|bool
      * @throws Exception
      */
-    public function rebuild($loggit = 0, $fallback = false, $progress = null)
+    public function rebuild($loggit = 0, $fallback = false, $progress = null, $skipErrorTracking = false)
     {
         global $prefs;
         $engineResults = null;
@@ -263,6 +263,7 @@ class UnifiedSearchLib
         try {
             $indexDecorator = new Search_Index_TypeAnalysisDecorator($index);
             $indexer = $this->buildIndexer($indexDecorator, $loggit);
+            $indexer->setErrorTrackingEnabled(! $skipErrorTracking);
             $lastStats = $tikilib->get_preference('unified_last_rebuild_stats_' . $prefs['unified_engine'], [], true);
 
             $stat = $tikilib->allocate_extra(



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/9df004efaa9d70fda9b64a330e07816f6cf539e7

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/9df004efaa9d70fda9b64a330e07816f6cf539e7
You're receiving this email because of your account on gitlab.com.

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.