Page MenuHomePhabricator

incategory: search prefix returning fatal error.
Closed, ResolvedPublic

Description

When using the incategory: search the following fatal error occurs:

Fatal error: Call to a member function selectField() on a non-object in E:\usr\Apache2.2\htdocs\wiki\extensions\SphinxSearch\SphinxMWSearch.php on line 298

This can be solved by adding the following line to the start of the filterByCatelog function in SphinxMWSearch.php

$this->db = wfGetDB( DB_SLAVE );

The resulting function is as followings:

function filterByCategory( $matches ) {
              $this->db = wfGetDB( DB_SLAVE );
 
              $page_id = $this->db->selectField( 'page', 'page_id',
                      array(
                              'page_title' => $matches[ 3 ],
                              'page_namespace' => NS_CATEGORY
                      ),
                      __METHOD__
              );
              $category = intval( $page_id );
              if ( $matches[ 1 ] === '-' ) {
                      $this->exc_categories[ ] = $category;
              } else {
                      $this->categories[ ] = $category;
              }
              return '';
      }

My Configuration:

Spinx 2.2.9
SphinxSearch MW Extension 0.9

MediaWiki 1.24.1

Event Timeline

WMurphy raised the priority of this task from to Needs Triage.
WMurphy updated the task description. (Show Details)
WMurphy subscribed.

@WMurphy: Thanks for reporting this and for taking a look at the code!

You are very welcome to use developer access to submit this as a Git branch directly into Gerrit.

Putting your branch in Git makes it easier to review it quickly. If you don't want to set up Git/Gerrit, you can also use the Gerrit Patch Uploader. Thanks again!

I missed this bug report earlier and submitted a different fix for the same issue in: https://gerrit.wikimedia.org/r/#/c/229725/ .

Thanks! Manually adding Patch-For-Review here (happens automatically when following the commit message guidelines)

Any update about this? I'm having the same issue. @Aklapper

Please feel free to contact the maintainer(s) of this extension for updates.

Platonides claimed this task.
Platonides subscribed.

I have merged @Rosencrantz patch. It only had to wait for 1 year and 4 months :(

@jartes, please try the latest version of SphinxSearch extension from git master.