Code Monkey home page Code Monkey logo

Comments (2)

LeoniePhiline avatar LeoniePhiline commented on May 26, 2024

Here a diff of making that happen:

diff --git a/typo3conf/ext/tika/Classes/Report/TikaStatus.php b/typo3conf/ext/tika/Classes/Report/TikaStatus.php
index 9ba5367b..aec032fb 100644
--- a/typo3conf/ext/tika/Classes/Report/TikaStatus.php
+++ b/typo3conf/ext/tika/Classes/Report/TikaStatus.php
@@ -26,6 +26,7 @@ namespace ApacheSolrForTypo3\Tika\Report;
 
 use ApacheSolrForTypo3\Solr\ConnectionManager;
 use ApacheSolrForTypo3\Tika\Service\Tika\ServerService;
+use ApacheSolrForTypo3\Tika\Service\Tika\SolrCellQuery;
 use ApacheSolrForTypo3\Tika\Utility\FileUtility;
 use TYPO3\CMS\Core\Utility\CommandUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -180,6 +181,23 @@ class TikaStatus implements StatusProviderInterface
             $solr = $this->getSolrServiceFromTikaConfiguration();
 
             $solr->ping();
+
+            // Perform a n extraction query to load the queryhandler if it is configured for lazy-loading.
+            $query = GeneralUtility::makeInstance(
+                SolrCellQuery::class,
+                GeneralUtility::getFileAbsFileName('EXT:tika/ext_emconf.php')
+            );
+            $query->setExtractOnly();
+
+            // todo: this can be removed when we drop EXT:solr 3.1 compatibility
+            $solrVersion = $this->getExtSolrVersion();
+            if(version_compare($solrVersion, '3.1', '>')) {
+                $solr->extractByQuery($query);
+            } else {
+                $solr->extract($query);
+            }
+
+            // Check if plugin is (possibly lazy-) loaded
             $plugins = $solr->getPluginsInformation();
             if (array_key_exists(
                 '/update/extract',
@@ -268,4 +286,17 @@ class TikaStatus implements StatusProviderInterface
     {
         GeneralUtility::devLog($message, $extKey, $severity, $data);
     }
+
+    /**
+     * Gets the Solr Version reduced to major and minor digits
+     *
+     * @return float
+     */
+    protected function getExtSolrVersion()
+    {
+        $solrVersion = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getExtensionVersion('solr');
+        $strippedSolrVersion = substr($solrVersion, 0, 3);
+
+        return $strippedSolrVersion;
+    }
 }

from ext-tika.

FireLizard avatar FireLizard commented on May 26, 2024

Should this become a PR, @LeoniePhiline? ;)

from ext-tika.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.