Extension talk:SphinxSearch/2023
This page used the Structured Discussions extension to give structured discussions. It has since been converted to wikitext, so the content and history here are only an approximation of what was actually displayed at the time these comments were made. |
![]() Archives
|
---|
|
Help
When seeking help and/or support, you might want to consider to mention your system environment (SphinxSearch Extension version, Sphinx version, MW version etc.) otherwise it might be difficult for people to make appropriate recommendations.
For Windows users and related issues see here, for Linux users and related issues see here, and some advice on how to configure a SQLite setup see here.
Issues with SphinxSearch in 1.39
We upgrade from the version 1.35.8 LTS to 1.39.1 LTS and we get the following Issues:
1- "connection to localhost:9312 failed (errno=111, msg=Connection refused)"
2- "Interner Fehler: received zero-sized searchd response"
Hier are the fix for this issues:
- SphinxMWSearchResult:
@@ -20,9 +20,10 @@ class SphinxMWSearchResult extends RevisionSearchResult {
* @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 @@ public function getTextSnippet( $terms = [] ) {
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 @@ public function getTextSnippet( $terms = [] ) {
$excerpts = $this->sphinx_client->BuildExcerpts(
[ $this->mText ],
$wgSphinxSearch_index,
implode( ' ', $terms ),
implode( ' ', $this->terms ),
$excerpts_opt
);
- SphinxMWSearchResultSet:
@@ -245,7 +245,7 @@ public function next() {
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;
} 46.31.222.226 (talk) 16:05, 18 January 2023 (UTC)
- Many thanks for this patch! I observed the same issue as you and this patch solved it for me, too.
- Since something broke the formatting of your patch, here's what I used:
- Rrosenfeld (talk) 13:54, 29 June 2023 (UTC)
--- 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; }