Extension talk:SphinxSearch/2023

The talk page now uses liquid threads, all open messages prior to liquid threads have been converted into a talk subpage and can be found here.
It is recommended to use SphinxSearch 0.8.5 and a recent stable release of Sphinx 2.1. Please bear in mind that this extension only handles the communication between MediaWiki and Sphinx and any specific issues related to the search feature (character sets, ability to search with *, search categories, minimum length on search terms etc.) are handled in Sphinx (see sphinx.conf file) and those questions should be redirected to the Sphinx forum.
The development on this extension is done on a voluntary basis and while this forum provides a platform to share experiences and solutions, it is up to its community members to fill in suggestions.

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:
--- 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;
 		}
Rrosenfeld (talk) 13:54, 29 June 2023 (UTC)
Category:Talk pages with syntax highlighting errors