Topic on Extension talk:SphinxSearch

Strict Standards error when executing a search on new install of SphinxSeach extension.

10
208.206.3.254 (talkcontribs)

I'm installing Sphinx-2.0.4 with the Mediawiki 1.19 with SphinxSearch extension version 0.8.5. I am running on Windows 2008 R2, Apache 2.4.2, MYSQL 5.5.24, and PHP5.4.3. The install goes fine following the windows installion instructions from the MediaWiki SphinxSearch extension page.

I then launch my wiki and enter a string "test string" into the search and click the search button. At this point I get the following error at the top of my wiki page:

Strict Standards: Declaration of SphinxMWSearch::userHighlightPrefs() should be compatible with SearchEngine::userHighlightPrefs() in E:\Apache24\htdocs\w\extensions\SphinxSearch\SphinxMWSearch.php on line 329

There are search results returned but I don't know how accurate and I need clear this message. I've spent two week on this and I can't find a solution.

This happens no matter what page I'm on when I search which makes the search totally useless to the company. How do I correct this? I can email my sphinx.conf, localSettings.php, and SphinxMWSearch.php files etc... if you give me an email address.

Thanks, -Tom

Svemir Brkic (talkcontribs)

You could do one or both of these:

  • Turn off "Strict Standards" in your php.ini. I do not run php 5.4 right now, but it should not be too hard to figure out. At least turn it off in production environment.
  • Change SphinxMWSearch::userHighlightPrefs declaration to match SearchEngine::userHighlightPrefs() - probably something related to public vs. protected or private.

We will fix it in the code eventually, but you seem to need a quick fix.

208.206.3.254 (talkcontribs)

I was able to turn off strict standards in php.ini. This go rid of the error. Changed:

error_reporting = E_ALL

to error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT Is there anything I should be on the lookout for with error_reporting set this way?

I took a look at SphinxMWSearch.php and only see a userHighlightPrefs declaration shown below and then it being called later(also shown below). Both snippits posted below. What should I change? Sorry I'm not a programmer.

public static function userHighlightPrefs( &$user ) { $contextlines = $user->getOption( 'contextlines', 2 ); $contextchars = $user->getOption( 'contextchars', 75 ); return array( $contextlines, $contextchars ); }


function getTextSnippet( $terms ) { global $wgUser, $wgAdvancedSearchHighlighting; global $wgSphinxSearchMWHighlighter, $wgSphinxSearch_index;

$this->initText(); list( $contextlines, $contextchars ) = SphinxMWSearch::userHighlightPrefs( $wgUser ); if ( $wgSphinxSearchMWHighlighter ) { $h = new SearchHighlighter(); if ( $wgAdvancedSearchHighlighting ) { return $h->highlightText( $this->mText, $terms, $contextlines, $contextchars ); } else { return $h->highlightSimple( $this->mText, $terms, $contextlines, $contextchars ); } }

Svemir Brkic (talkcontribs)

If you changed php.ini for all environments, you are fine. That is just a notice, not an error.

12.111.225.77 (talkcontribs)

The Strict Standards notice is being displayed because userHighlightPrefs is indeed declared differently:

  • In MediaWiki 1.20.5, SearchEngine.php the declaration is for 'all users' as: userHighlightPrefs()
  • In SphinxSearch 0.8.5, SphinxMWSearch.php the declaration is for a 'given user' as: userHighlightPrefs( &$user )


And of course the corresponding differences in variable assignment statements inside the function(s)...

149.6.134.59 (talkcontribs)

Hello! Im sorry, Im quite newbish about all this stuff... But how do you turn those script standards off (in php.ini ). I cant find it..

Svemir Brkic (talkcontribs)

That was already answered in a previous reply. Make sure something like this is set in your php.ini:

error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT
149.6.134.59 (talkcontribs)

Thank you Done. I don't think it's required to restart the server, is it? Because the error is still there.

+ You also proposed to change SphinxMWSearch::userHighlightPrefs declaration to match SearchEngine::userHighlightPrefs(), but where can I do that?

Once again Im absolutly not used to it and Im sorry for that...

Thank you

Svemir Brkic (talkcontribs)

You dont need to restart the whole server, but you do need to restart apache (which might be what you meant when you said server anyway...)

Once you do that, you probably do not need to change that declaration.

Reply to "Strict Standards error when executing a search on new install of SphinxSeach extension."