wikimedia/mediawiki-extensions-CirrusSearch

View on GitHub

Showing 691 of 718 total issues

Method processResultSet has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function processResultSet( CirrusSearchResultSet $value, $query ) {
        // these are prefix or full text results
        $rows = [];
        foreach ( $value as $result ) {
            /** @var CirrusSearch\Search\CirrusSearchResult $result */
Severity: Minor
Found in maintenance/RunSearch.php - About 1 hr to fix

    Method getRequests has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getRequests() {
            if ( !$this->request || !$this->response ) {
                // we don't actually know at this point how many searches there were,
                // or how many results to return...so just bail and return nothing
                return [];
    Severity: Minor
    Found in includes/MultiSearchRequestLog.php - About 1 hr to fix

      Method updateLinkedArticles has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function updateLinkedArticles( $titles ): void {
              $pages = [];
              $wikiPageFactory = MediaWikiServices::getInstance()->getWikiPageFactory();
              foreach ( $titles as $title ) {
                  // Special pages don't get updated, we only index
      Severity: Minor
      Found in includes/Updater.php - About 1 hr to fix

        Method makeRemoteReindexInfo has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function makeRemoteReindexInfo( Connection $source, Connection $dest ) {
                if ( $source->getClusterName() === $dest->getClusterName() ) {
                    return null;
                }
        
        
        Severity: Minor
        Found in includes/Maintenance/Reindexer.php - About 1 hr to fix

          Method handleSearchGetNearMatch has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function handleSearchGetNearMatch( $term, &$titleResult ) {
                  global $wgSearchType;
                  if ( $wgSearchType !== 'CirrusSearch' ) {
                      return true;
                  }
          Severity: Minor
          Found in includes/Hooks.php - About 1 hr to fix

            Method initializeForRequest has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function initializeForRequest( WebRequest $request ) {
                    global $wgCirrusSearchPhraseRescoreWindowSize,
                        $wgCirrusSearchFunctionRescoreWindowSize,
                        $wgCirrusSearchFragmentSize,
                        $wgCirrusSearchPhraseRescoreBoost,
            Severity: Minor
            Found in includes/Hooks.php - About 1 hr to fix

              Method fix has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function fix( $replacement ) {
                      Assert::precondition( $this->visited, "getFixablePart must be called before trying to fix the query" );
                      if ( $this->node === null ) {
                          return null;
                      }
              Severity: Minor
              Found in includes/Parser/AST/Visitor/QueryFixer.php - About 1 hr to fix

                Method decidePage has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function decidePage( Updater $updater, WikiPage $page ) {
                        try {
                            $content = $page->getContent();
                        } catch ( Throwable $ex ) {
                            LoggerFactory::getInstance( 'CirrusSearch' )->warning(
                Severity: Minor
                Found in maintenance/ForceSearchIndex.php - About 1 hr to fix

                  Method buildChunks has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function buildChunks( $buildChunks ) {
                          $dbr = $this->getDB( DB_REPLICA, [ 'vslow' ] );
                          if ( $this->toId === null ) {
                              $this->toId = $dbr->newSelectQueryBuilder()
                                  ->select( 'MAX(page_id)' )
                  Severity: Minor
                  Found in maintenance/ForceSearchIndex.php - About 1 hr to fix

                    Method __construct has 9 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            SearchConfig $config,
                            Connection $connection,
                            Remediator $remediator,
                            Searcher $searcher,
                            StatsFactory $statsFactory,
                    Severity: Major
                    Found in includes/Sanity/Checker.php - About 1 hr to fix

                      Method __construct has 9 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public function __construct( Connection $conn, $limit, $offset = 0, SearchConfig $config = null, array $namespaces = null,
                              User $user = null, $index = false, $profileName = null,
                                                       CirrusDebugOptions $debugOptions = null ) {
                      Severity: Major
                      Found in includes/CompletionSuggester.php - About 1 hr to fix

                        Method __construct has 9 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                Client $client,
                                $aliasName,
                                $specificIndexName,
                                $startOver,
                                Reindexer $reindexer,
                        Severity: Major
                        Found in includes/Maintenance/Validators/SpecificAliasValidator.php - About 1 hr to fix

                          Method __construct has 9 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                  $startOffset,
                                  $endOffset,
                                  KeywordFeature $keyword,
                                  $key,
                                  $value,
                          Severity: Major
                          Found in includes/Parser/AST/KeywordFeatureNode.php - About 1 hr to fix

                            Method __construct has 9 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                    Connection $connection,
                                    SearchConfig $config,
                                    array $namespaces = null,
                                    User $user = null,
                                    CirrusDebugOptions $debugOptions = null,
                            Severity: Major
                            Found in includes/InterwikiSearcher.php - About 1 hr to fix

                              Method getStatus has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function getStatus() {
                                      if ( $this->response ) {
                                          // task complete
                                          return $this->response;
                                      }
                              Severity: Minor
                              Found in includes/Elastica/ReindexTask.php - About 1 hr to fix

                                Method loadDocuments has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function loadDocuments( PageIdentity $title, $sourceFiltering = true ) {
                                        [ $docId, $hasRedirects ] = $this->determineCirrusDocId( $title );
                                        if ( $docId === null ) {
                                            return [];
                                        }
                                Severity: Minor
                                Found in includes/Api/ApiTrait.php - About 1 hr to fix

                                  Method __construct has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      private function __construct( $repoType, $repoName, SearchConfig $config, callable $arrayLoader ) {
                                          $this->wrapped = ArrayProfileRepository::lazyLoaded( $repoType, $repoName, static function () use ( $arrayLoader, $config ) {
                                              $profiles = [];
                                  
                                              $allowedFields = [ 'suggest' => true, 'suggest-stop' => true ];
                                  Severity: Minor
                                  Found in includes/Profile/CompletionSearchProfileRepository.php - About 1 hr to fix

                                    Method bulkResponseExceptionIsJustDocumentMissing has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        protected function bulkResponseExceptionIsJustDocumentMissing(
                                            ResponseException $exception, $logCallback = null
                                        ) {
                                            $justDocumentMissing = true;
                                            foreach ( $exception->getResponseSet()->getBulkResponses() as $bulkResponse ) {
                                    Severity: Minor
                                    Found in includes/DataSender.php - About 1 hr to fix

                                      Method upgradeIndexVersion has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          private function upgradeIndexVersion() {
                                              $pluginsStatus = $this->configUtils->scanAvailableModules();
                                              if ( !$pluginsStatus->isGood() ) {
                                                  throw new \RuntimeException( (string)$pluginsStatus );
                                              }
                                      Severity: Minor
                                      Found in includes/MetaStore/MetaStoreIndex.php - About 1 hr to fix

                                        Method buildDocument has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            public static function buildDocument( Connection $connection, $baseName, $typeName ) {
                                                global $IP;
                                                if ( $typeName == Connection::TITLE_SUGGEST_INDEX_SUFFIX ) {
                                                    [ $aMaj, $aMin ] = explode( '.', SuggesterAnalysisConfigBuilder::VERSION, 3 );
                                                    [ $mMaj, $mMin ] = explode( '.', SuggesterMappingConfigBuilder::VERSION, 3 );
                                        Severity: Minor
                                        Found in includes/MetaStore/MetaVersionStore.php - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language