Steps to replicate the issue (include links if applicable):
- Install https://www.mediawiki.org/wiki/Extension:SphinxSearch SphinxSearch-REL1_39-686aba9.tar.gz
- Use Debian bullseye sphinxsearch 2.2.11-8~bpo11+1 as backend
- Search something with multiple results via fulltext search
What happens?:
- The SphinxSearch extension lists the title of all findings, but below the titles there are only error messages (instead of the expected snipplets with the matching string)
- For the first finding: "Internal Error: received zero-sized searchd response"
- For all others findings: "connection to localhost:9312 failed (errno=111, msg=Connection refused)"
- This is because searchd crashed (signal 11) during reply of first snipplet and isn't available for the other requests.
What should have happened instead?:
- searchd shouldn't crash but return the snpplets.
Workaround/Solution:
In https://www.mediawiki.org/wiki/Topic:Xaxmjdw91ezh5uss I found someone reporting the same issue and providing a little patch, that solves the issue for me.
Here's the patch:
--- SphinxMWSearchResult.php.org 2023-03-14 09:32:43.000000000 +0100 +++ SphinxMWSearchResult.php 2023-06-29 15:47:04.311199198 +0200 @@ -20,9 +20,10 @@ * @param stdClass $row * @param SphinxClient|null $sphinx_client */ - public function __construct( $row, $sphinx_client ) { + public function __construct( $row, $sphinx_client, $terms ) { $this->sphinx_client = $sphinx_client; $this->initFromTitle( Title::makeTitle( $row->page_namespace, $row->page_title ) ); + $this->terms = $terms; } /** @@ -40,9 +41,9 @@ if ( $wgSphinxSearchMWHighlighter ) { $h = new SearchHighlighter(); if ( $wgAdvancedSearchHighlighting ) { - return $h->highlightText( $this->mText, $terms, $contextlines, $contextchars ); + return $h->highlightText( $this->mText, $this->terms, $contextlines, $contextchars ); } else { - return $h->highlightSimple( $this->mText, $terms, $contextlines, $contextchars ); + return $h->highlightSimple( $this->mText, $this->terms, $contextlines, $contextchars ); } } @@ -57,7 +58,7 @@ $excerpts = $this->sphinx_client->BuildExcerpts( [ $this->mText ], $wgSphinxSearch_index, - implode( ' ', $terms ), + implode( ' ', $this->terms ), $excerpts_opt ); --- SphinxMWSearchResultSet.php.org 2023-03-14 09:32:43.000000000 +0100 +++ SphinxMWSearchResultSet.php 2023-06-29 15:48:16.289051002 +0200 @@ -245,7 +245,7 @@ if ( isset( $this->mResultSet[$this->mNdx] ) ) { $row = $this->mResultSet[$this->mNdx]; ++$this->mNdx; - return new SphinxMWSearchResult( $row, $this->sphinx_client ); + return new SphinxMWSearchResult( $row, $this->sphinx_client, $this->mTerms ); } else { return false; }
It would be nice, if this could be merged into the code base...
Greetings
Roland