Extension talk:SphinxSearch/2012

Usage with Sphinx 2.0.4

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


Has anyone been able to successfully use this extension with Sphinx version 2.0.4? I receive the following error when "testing out sphinx" (step 4):

 index 'wiki_main': search error: .

The only explanation I can think of is that perhaps the way the config file sets up the index is no longer compatible with the newer version of Sphinx. Has anyone been able to successfully run Sphinx 2.0.4 with their wiki, or should I downgrade my installation to Sphinx 2.0.3? I appreciate any assistance.

Update: The SphinxSearch extension itself appears to be functional even though queries from the command line are not. Feel free to close/delete this support thread. Jake8 (talk) 13:48, 6 May 2012 (UTC)

Actually we are using 2.0.4 in production with the latests SphinxSearch 0.8+ and we are using the exact same setup as with. (we haven't changed the configuration neither in case of 2.0.3/2.0.4). I'm not sure from where you get the message testing out sphinx, we have never seen this kind of message coming from Sphinx nor SphinxSearch. --MWJames (talk) 00:43, 6 May 2012 (UTC)
Oh no, I meant that I received the error in the code block in my original post when following the instructions under the "test out sphinx" step on the SphinxSearch article. The string "testing out sphinx" was never returned from either system.
As I wrote in my update though, SphinxSearch seems to work perfectly on the wiki itself (through the search daemon) even though it's broken from the command line. I have no idea what's causing this, but I guess it must be unique to my system configuration.
Thanks a lot for your help, and for your work on this excellent extension! :) Jake8 (talk) 02:38, 19 May 2012 (UTC)
That's my experience too. The "search" command line function from 2.0.4 (built from source) and 2.0.5 (both built from source and installed from deb) gives "index 'wiki_main': search error: ." if any search terms at all are entered on the command line. However the "searchd" daemon and the MW extension which relies on that work. So the instructions to use "search" to test the installation currently lead to a dead end. Still, "search" is only a test utility, not meant for use once it's in production. WhitBlauvelt (talk) 21:29, 1 October 2012 (UTC)
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

Sphinx Extension Doesnt work for me

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


I am new to media wiki and for that matter to any web application development. I was exploring Mediawiki and have installed "MediaWiki 1.18.2" and have attempted to integrate Sphinx search. I have used "Sphinx 2.0.4-release".

The problem I am facing is that I am unable to search through the contents of the pages or the documents embedded in the MediWiki. It is only able to search the Title of the Pages. This is the same irrespective of the "GO" button or the "SEARCH" button. Whereas Through the command in the Sphinx Search, I am able to find all the text. Can someone please help me in debugging this. Sashidhar (talk) 08:54, 11 May 2012 (UTC)

The documentation is quite extensive (compared with other extensions), and it might be that you need to do the setup more than ones to fully understand the implication in how searchd, indexer and SphinxSearch is working together. If you follow the steps outlined in the documentation you should be able get the extension working but it will be hard for anyone to give any guidance as long their are no particular problems to solve.
For example did you do "Step 4 - Test Out Sphinx" to ensure that the infrastructure is setup correctly otherwise if this step fails something is wrong in your configuration and searching within MediaWiki will definitely not work as advertised.
In order to use Sphinx in MediaWiki you have register the extension, see "Step 9 - Extension Installation - Local Settings"
You should also consult the Extension:SphinxSearch/Troubleshooting page. MWJames (talk) 10:32, 11 May 2012 (UTC)
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

SphinxSearch and MediaWiki 1.19.0 -- fixed

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


After migraging to MediaWiki 1.19.0 SphinxSearch 0.85 does not work on the Spechial:Search page anymore (no results). The sidebar Search works.

After logging the searchd with --console, you found a message "query error: no such filter attribute 'page_is_redirect'" in the console. I searched this text and found it in 'SphinxMWSearch.php'. I change the line

$cl->SetFilter( 'page_is_redirect', array( 0 ) );

to

// $cl->SetFilter( 'page_is_redirect', array( 0 ) );

and everything works (for me).

I also change the method 'userHighlightPrefs' to

	public static function userHighlightPrefs() {return array( 2, 75 ); }

because the the definition changed (and I got warning when I activated "$wgShowExceptionDetails" in LocalSettings.php).

I hope this helps others fixing the same problems. 212.23.156.114 08:21, 16 May 2012 (UTC)

Perhaps page_is_redirect is missing in the sphinx.conf? It did not use to be there by default, but in more recent versions you should see it in at least three places in your sphinx.conf, in both sql_query settings, and in one sql_attr_uint setting. After you change the config file, you need to reindex the wiki. Svemir Brkic (talk) 14:23, 16 May 2012 (UTC)
Hello Svemir,
thanx, that was the solution. 212.23.156.114 14:20, 21 May 2012 (UTC)
During our tests with MW 1.19 / SphinxSearch 0.8.5 we haven't seen any problems and therefore are able to run SphinxSearch 0.8.5 without any changes on MW 1.19. MWJames (talk) 15:35, 16 May 2012 (UTC)
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

Trouble to find words in pages that are inside a custom namespace

I am having trouble to find words in pages that are inside a custom namespace.

I have installed Sphinx and SphinxSearch and it seems to be working, the queries are definitely going from the MediaWiki UI to the sphinx daemon, I executed "searchd.exe" in the console, and it is receiving the words that I type in the mediawiki search box.

If I type a word that exists in the main page, then it finds the main page, but if I type a word that is in a page with a custom namespace, then nothing... mediawiki just gives the option to create a new page, and nothing more.

I am sure that the word I am searching is there, and that sphinx can find it. If I execute "search.exe" and try to find the very same words, it says that it exists in some documents with a lot of hits.

I am executing this:

   search -c C:\Sphinx\sphinx.conf -i wiki_main -e "equip"

and it returns this:

   displaying matches:
   1. document=5, weight=2620, page_namespace=3000, page_is_redirect=0, old_id=11,
   category=()
           page_title=Equipe
           page_namespace=3000
   2. document=4, weight=1620, page_namespace=3000, page_is_redirect=0, old_id=12,
   category=()
           page_title=Principal
           page_namespace=3000
   words:
   1. 'equip': 2 documents, 4 hits

Notice that it knows about my custom namespace that have the id=3000.

If I try to search for the same thing using MediaWiki search box, the search daemon shows this:

   [Fri May 18 11:20:44.101 2012] 0.004 sec [ext2/1/rel 0 (0,20)] [*] equip

That means that it is receiving the "equip" word from the search box. But MediaWiki just says that there is no results, and suggests that I create the page.

What is wrong?

Why I cannot find the same results from "search.exe", by using MediaWiki search box?

Thanks! 200.251.63.3 14:27, 18 May 2012 (UTC)

Are you sure your custom namespace is selected? By default, MW searches only a limited set of namespaces. You need to change your search preferences, or use "Everything" or "Advanced" tabs to search additional namespaces. Svemir Brkic (talk) 15:00, 18 May 2012 (UTC)
This might be of interest default namespaces setting. MWJames (talk) 08:06, 19 May 2012 (UTC)

$wgMaxShellMemory default value too low for SphinxSearch_setup.php (MediaWiki 1.19, Sphinx 0.8.5/r115479, Sphinx 2.0.4)

I'm running MediaWiki in a Fedora 16 virtual machine (MediaWiki 1.19, Sphinx 0.8.5/r115479, Sphinx 2.0.4). Thanks for the great extension and documentation. The documentation was clear except for two issues. First, it wasn't clear that php enchant support had to be separately installed (php-enchant package on Fedora). Second, when running php SphinxSearch_setup.php to build the "Did you mean?" suggestion dictionary, the sphinx indexer kept crashing with an odd error: "libgcc_s.so.1 must be installed for pthread_cancel to work". But running the appropriate command indexer --buildstops ... directly worked fine. I saw that ulimit was being used to set resource limits on the shell used to run the indexer in the case of SphinxSearch_setup.php. It turned out that the default value of 102400 KB for the memory limit was too low for an almost-empty (4 documents, 4531 bytes - did I mention it was almost empty) instance of MediaWiki. I don't understand how this could be, so if anyone has ideas please let me know. Setting wgMaxShellMemory to 204800 KB in LocalSettings.php worked. 198.176.188.201 22:20, 5 June 2012 (UTC)

On my development box (47 docs, 17983 bytes) it works just fine with the default memory settings. Currently I have Sphinx 2.0.2 here, but I do not think that would be a reson for a huge difference in memory usage. Perhaps something related to PHP version you use or some settings it has? Svemir Brkic (talk) 13:57, 7 June 2012 (UTC)

Minor typo fix

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


I got tripped up by the use of 'spinxconf' instead of 'sphinxconf' as an option to SphinxSearch_setup.php. The following patch may avoid minor confusion for new users:

--- a/SphinxSearch/SphinxSearch_setup.php   2012-06-04 14:08:10.000000000 -0700
+++ b/SphinxSearch/SphinxSearch_setup.php   2012-06-05 12:59:57.289298038 -0700
@@ -24,7 +24,7 @@
        
        /* Override parameters setup becuase we do not need some of the default ones */
        protected function addDefaultParams() {
-               $this->addOption( 'spinxconf', 'Location of Sphinx configuration file', true, true );
+               $this->addOption( 'sphinxconf', 'Location of Sphinx configuration file', true, true );
                $this->addOption( 'indexer', 'Full path to Sphinx indexer if not in the path', false, true );
                $this->addOption( 'useindex', 'Sphinx index to use (defaults to wiki_main)', false, true );
                $this->addOption( 'maxwords', 'Maximum number of words to extract (defaults to 10000)', false, true 
@@ -36,7 +36,7 @@
                $max_words = intval( $this->getOption( 'maxwords', 10000 ) );
                $indexer = wfEscapeShellArg( $this->getOption( 'indexer', 'indexer' ) );
                $index = wfEscapeShellArg( $this->getOption( 'useindex', 'wiki_main' ) );
-               $conf = wfEscapeShellArg( $this->getOption( 'spinxconf' ) );
+               $conf = wfEscapeShellArg( $this->getOption( 'sphinxconf' ) );
 
                $cmd = "$indexer  --config $conf $index --buildstops sphinx.dic $max_words";
                $this->output( wfShellExec( $cmd, $retval ) );
198.176.188.201 22:27, 5 June 2012 (UTC)
Thank you for the fix. MW and extensions are moving from SVN to Git - I will apply and commit your change once all that is done. Svemir Brkic (talk) 00:54, 6 June 2012 (UTC)
It seems like its going it be a while before this extension is moved to Git. I made the change in SVN now (revision 115486) Svemir Brkic (talk) 12:18, 7 June 2012 (UTC)
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

Using Sphinx with Multi-Wiki Sites

We use 5 different wiki sites by introducing an HTTP switch statement in our LocalSettings.php which selects other LocalSettings_wiki1.php, LocalSettings_wiki2.php files. Additionally, each wiki has its own DB prefix. IE: wiki1_, wiki2_, etc...

When I changed the sphinx.conf file to include the wiki1_ prefix, wiki1 works great, but wiki2 and 3 don't return good searches.

How can I fix this?

Thank you so much! 97.78.241.155 17:58, 8 June 2012 (UTC)

Please provide a link to your sphinx.conf file (with passwords etc. removed of course.) Also include your "HTTP switch statement" Svemir Brkic (talk) 18:22, 8 June 2012 (UTC)
http://pastebin.com/MDuRMszc = LocalSettings.php
http://pastebin.com/ZQZfZVyJ = sphinx.conf
Note: The DB prefix in sphinx.conf is IES_ 97.78.241.155 20:20, 8 June 2012 (UTC)
Maybe I am missing something, but I see only one index definition in the sphinx file. Do you have one instance of sphinx daemon running, or one per database? If you have only one, you are correct that you need different index name for each one, but those indexes need to be define in the sphinx.conf file (they can each extend the main one, so that you do not need to repeat everything.) Svemir Brkic (talk) 20:31, 8 June 2012 (UTC)
So I can run more daemons with separate .conf files, and then reference them in each LocalSettings_wikiX.php file? 97.78.241.155 21:14, 8 June 2012 (UTC)
You can have sphinx instance with one sphinx.conf file, with multiple sphinx indexes defined in that file. If you do not have too much traffic, you probably want to do it this way.
Or you can have multiple sphinx instances, each with their own sphinx.conf file, each running on their own port or IP address. You probably only want to do this if you have a lot of traffic and can run each instance on a different box. Svemir Brkic (talk) 22:12, 8 June 2012 (UTC)
Do you have an example of how to define multiple indices? Thanks! 97.78.241.155 22:52, 8 June 2012 (UTC)

Enable search box suggestions-as-you-type that match words or phrases anywhere in the page title

I've slightly modified the extension to enable suggestions-as-you-type for the search box that match a word or phrase anywhere in the page title, not just at the beginning. For instance, typing "baby strol" should bring up pages with titles "Plik-o-matic baby stroller 2003", "Swift Baby Stroller", "Zippy one hand fold baby stroller by inglesina - new 2005", etc. as seen in this example. Use the patch below and add the following lines to LocalSettings.php:
$wgEnableMWSuggest = true;
$wgEnableSphinxInfixSearch = true;
Note that this overrides $wgEnableSphinxPrefixSearch = true; (search suggestions matching the beginning of the page title only).
--- a/SphinxSearch/SphinxSearch.php
+++ b/SphinxSearch/SphinxSearch.php
@@ -103,10 +103,17 @@
 # $wgEnableMWSuggest needs to be set to true as well
 $wgEnableSphinxPrefixSearch = false;
 
+# Same as $wgEnableSphinxPrefixSearch except that search suggestions include
+# matches against words in the middle of the page title. Takes precedence 
+# over wgEnableSphinxPrefixSearch if both are true.
+$wgEnableSphinxInfixSearch = false;
+
 function efSphinxSearchPrefixSetup() {
-       global $wgHooks, $wgEnableSphinxPrefixSearch;
+       global $wgHooks, $wgEnableSphinxPrefixSearch, $wgEnableSphinxInfixSearch;
 
-       if ( $wgEnableSphinxPrefixSearch ) {
+       if ( $wgEnableSphinxInfixSearch ) {
+               $wgHooks[ 'PrefixSearchBackend' ][ ] = 'SphinxMWSearch::infixSearch';
+       } elseif ( $wgEnableSphinxPrefixSearch ) {
                $wgHooks[ 'PrefixSearchBackend' ][ ] = 'SphinxMWSearch::prefixSearch';
        }
 }
--- a/SphinxSearch/SphinxMWSearch.php
+++ b/SphinxSearch/SphinxMWSearch.php
@@ -56,6 +56,23 @@
        }
 
        /**
+        *  PrefixSearchBackend override for OpenSearch results
+        */
+       static function infixSearch( $namespaces, $term, $limit, &$results ) {
+               $search_engine = new SphinxMWSearch( wfGetDB( DB_SLAVE ) );
+               $search_engine->namespaces = $namespaces;
+               $search_engine->setLimitOffset( $limit, 0 );
+               $result_set = $search_engine->searchText( '@page_title: ' . $term . '*' );
+               $results = array();
+               if ( $result_set ) {
+                       while ( $res = $result_set->next() ) {
+                               $results[ ] = $res->getTitle()->getPrefixedText();
+                       }
+               }
+               return false;
+       }
+
+       /**
         * Perform a full text search query and return a result set.
         *
         * @param string $term - Raw search term
This works for me using MediaWiki 1.19 and SphinxSearch 0.8.5 (SVN rev 115479). The above also assumes that sphinx is already configured for infix searches using star syntax, which is the case if you followed the instructions on the install page. In other words, this requires sphinx.conf to include min_infix_len = n (where n is a positive integer) and enable_star = 1. 198.176.189.201 14:29, 19 June 2012 (UTC)
Hi 198.176.189.201. Could you please make a MediaWiki.org account, request a Gerrit account and submit this patch for review in Gerrit? Thanks. Krenair (talk contribs) 17:00, 19 June 2012 (UTC)
The [1] commit implements a prefix wildcard search.
- Enable wildcard prefix search suggestions
($wgSphinxPrefixSearchAdvanced = false;)
- Extend prefix search namespace beyond NS_MAIN
($wgSphinxPrefixSearchNamespaces = false;)
- Extend prefix result display limit
($wgSphinxPrefixSearchLimit = 15;)
[1] https://gerrit.wikimedia.org/r/#/c/15859/ MWJames (talk) 00:23, 18 July 2012 (UTC)
Hallo MWJames, I think this is a great idea. But on my 1.19 MW it just won't work. Sphinx itself is running smoothly but I cannot find out why the "InfixSearch" will NOT work.

I checked here: sphinx.conf:
min_infix_len = 1
enable_star = 1

And also in LocalSettings.php
$wgSearchType = 'SphinxMWSearch';
require_once( "$IP/extensions/SphinxSearch/SphinxSearch.php" );
$wgSphinxSearch_port = 9312;
$wgEnableSphinxInfixSearch = true;
$wgSphinxPrefixSearchAdvanced = true;
$wgSphinxPrefixSearchNamespaces = true;
$wgSphinxPrefixSearchLimit = 15;
I got the "updated" version from here: https://gerrit.wikimedia.org/r/#/c/15859/
Your help would be highly appreciated ;-) Thank you!!! SmartK (talk) 12:09, 16 August 2012 (UTC)
Ohhh, my fault. It wasn't MWJames how thought of this. I am sorry. So I just implemented the code from the anonymous user "198.176.189.201" ;-) Now the "InfixSearch" is working like a charm. Couldn't we implement this in standard git aswell? I think this would be really good! SmartK (talk) 12:22, 16 August 2012 (UTC)
Just found a "bug" with the now working "InfixSearch". As soon as I turn on "$wgEnableSphinxInfixSearch = true;" the auto-complete will NOT work IF there is a character like "ä, ö, ü" in the search-term. If the InfixSearch is OFF the auto-complete works flawless. SmartK (talk) 13:02, 16 August 2012 (UTC)
This is a great little patch and exactly what I was looking for! I got it working on my wiki http://linuxproblems.org/w/index.php?title=Special%3ASearch currently running mediawiki-1.24.1 and SphinxSearch 0.9.0
Is there any reason this hasn't gone into the main branch yet? Equick (talk) 11:29, 21 February 2015 (UTC)
There is a phabricator task for this feature now, and I am working on a patch for it: https://phabricator.wikimedia.org/T185056 Svemir Brkic (talk) 03:08, 17 September 2019 (UTC)
There is a code review in progress with this now: https://gerrit.wikimedia.org/r/538458 Svemir Brkic (talk) 01:34, 23 September 2019 (UTC)

How does Wikimedia add redirect links + section links into their search results?

For example, if you search the term 'maderia portugal' you get something similar to the following:



Is there any way to do this with SphinxSearch? 50.98.206.233 05:58, 26 July 2012 (UTC)

Not at this time. SphinxSearch is not parsing wiki content to get that kind of info. Some of it could be done as a part of the title search. Not sure when I can get into working on the extension again... Svemir Brkic (talk) 17:20, 30 August 2012 (UTC)

Sphinx Multi indexes for multi wiki on one db

Hello all, I'm trying to setup Sphinx to search on multiple wiki, I'm using a single db with 30 wiki using a different prefix for each one sample wiki and prefix linux_ windows_ networks_ dba_

I would like to setup a single sphinx.conf file with different indexes. I need to display search result for a single wiki and not for all,Example if I'm using windows wiki I want to be able to search and display only content for windows wiki/tables. Can you please post some sphinx.conf sample for multiple indexes based on table prefix, and also which changes I need to do on LocalSettings.php and Sphinx Extension?

Mediawiki 1.19.1 Centos 6.2 Mysql 5 Sphinx-2.0.5-1

thanks Valentina 80.254.147.236 10:53, 9 August 2012 (UTC)

I have the exact same goal as Valentina (linux though) and I am also looking for this answer. Does anyone know how to do this? SmartK (talk) 11:02, 14 August 2012 (UTC)
I solved it this way: for each wiki running on this server I created a new sphinx.conf file. In that file I changed the DB, the port as well as the names for the logs and the pid file. That was it. Now I have all of my three wikis running on sphinx, each having their own index. Perfect! SmartK (talk) 12:41, 16 August 2012 (UTC)

Setting Categories to be Ignored

Is there any way to set specific categories to be ignored by SphinxSearch? That is, not show up in results at all?

Many thanks - and apologies if I have missed something, I have tried to find the answer! MWkim (talk) 12:54, 23 August 2012 (UTC)

You could edit sphinx.conf queries that collect the data and make it skip anything you do not want to be indexed. That would NOT stop exact title matches (when GO instead of Search is used.) Svemir Brkic (talk) 13:05, 23 August 2012 (UTC)
Can you comment on using exc_category array in class SphinxMWSearch to accomplish this? Would that work, would that be a bad idea? Freddo411 (talk) 20:35, 29 August 2013 (UTC)
It may work, but it seems much safer and faster not to index those articles in the first place, by editing the main query. I would only try to use the exc_category if I had to show those articles to some users but not to others. Svemir Brkic (talk) 00:48, 30 August 2013 (UTC)

sphinx & search box query

Hi,

I try to use sphinx 2.04 with SphinxSearch 0.8.5 on mediawiki . When I use the special page it's work fine but when I use the top right search box. I have no request on sphinx. Visibly, mediawiki uses the default search engine ! but why ?

Anybody have an idea to resolve it ?

thanks Lutch 2904 (talk) 11:59, 30 August 2012 (UTC)

Make sure you have
$wgSearchType = 'SphinxMWSearch';
Before "require_once( "$IP/extensions/SphinxSearch/SphinxSearch.php" );" in LocalSettings.php Svemir Brkic (talk) 17:16, 30 August 2012 (UTC)
I'm sure.
I think it comes from the version of mediawiki(1.16.2). I don't understand why because the special:search page works perfectly.
When i search search
result page of search box request : Special%3ASearch&search=search (0 result)
result page of special:search request : Special%3ASearch&redirs=0&search=search&fulltext=Search&ns0=1 ( 40 results)
--------------------
After a lot of searchs , I have found that the special:search page creates her own searchengine object but I don't find where and how force the usage of sphinx
thanks in advance for your help Lutch 2904 (talk) 05:46, 31 August 2012 (UTC)
To get more help you need to provide more information. Perhaps post your LocalSettings.php somewhere - maybe there is something else in there that disables sphinx. Svemir Brkic (talk) 02:22, 26 September 2012 (UTC)
Hi,
that's the beginning of my localsettings.php. I tried to create a new installation but the probleme persists.
That's the default localsettings.php with only two extensions additions. I don't understand why it's don't work.

Any Idea is Welcome
Thanks
if( defined( 'MW_INSTALL_PATH' ) ) {
	$IP = MW_INSTALL_PATH;
} else {
	$IP = dirname( __FILE__ );
}
$path = array( $IP, "$IP/includes", "$IP/languages" );
set_include_path( implode( PATH_SEPARATOR, $path ) . PATH_SEPARATOR . get_include_path() );
require_once( "$IP/includes/DefaultSettings.php" ); 
if ( $wgCommandLineMode ) {
	if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
		die( "This script must be run from the command line\n" );
	}
}
$wgSearchType = 'SphinxMWSearch';
require_once( "$IP/extensions/SphinxSearch/SphinxSearch.php" );
require_once("$IP/extensions/SyntaxHighlight_Geshi/SyntaxHighlight_GeSHi.php");
## Uncomment this to disable output compression
# $wgDisableOutputCompression = true;
$wgSitename         = "Wiki";
...
Lutch 2904 (talk) 14:14, 8 October 2012 (UTC)
Hello,
I have found my problem. It was the same as Extension talk:SphinxSearch/2012#c-212.23.156.114-2012-05-16T08:21:00.000Z-SphinxSearch_and_MediaWiki_1.19.0_--_fixed.
Thank you again for your help. Lutch 2904 (talk) 13:51, 18 October 2012 (UTC)

Search Result: Context and Highlighting

Is the search context and highlighting with 0.8.5 still working as with 0.7.x releases?

Example
search for package: http://xinu.mscs.mu.edu/wiki/index.php?search=package+&go=Go&title=Special%3ASearch

In my config, I always get the beginning of the article, highlighting does not work at all. Did I miss something in my configuration? I tried to find a public 0.8.5 with no luck...

MW 1.16.1 SphinxSearch 0.8.5 Planetenxin (talk) 17:40, 3 September 2012 (UTC)

check what starts when the search button is clicked?

Hello, I am using sphinx-0.9.9-6.4, SphinxSearch 0.8.5, MediaWiki 1.19.1, Linux Suse 11. I followed the install and setting guide. Searching in command line works just fine. Searching in browser displays: There were no results matching the query. I checked the "common" issues sphinxapi.php, LocalSettings.php and sphinx.conf. Can I somehow check which processes start when Search button is clicked? Any idea is welcome. Thanks, Adam 193.179.76.222 10:53, 4 September 2012 (UTC)

I am trying to debug to find the problem.
I use wfDebug() and getLastError() and it shows the following error inside the Query() function:
Getting last error: index test1,test1stemmed: no such filter attribute 'page_namespace'
However the sql query in sphinx.conf considers page_namespace.
Has anyone experienced a similar problem?
Any idea is welcome. Thanks, Adam 193.179.76.222 10:45, 16 October 2012 (UTC)
I added the following lines inti the sphinx.conf.
sql_attr_uint = page_namespace
sql_attr_uint = page_is_redirect
And finally searching in browser returnes results. However the searching in browser appears to be using default search, meanwhile the searching in command line uses Sphinx search.
Adam 193.179.76.222 14:07, 24 October 2012 (UTC)
I recently upgraded from version SphinxSearch-0.9.8-release (r1533) to Sphinx 2.0.8-release (r3831) and in my sphinx.conf I copied over the old listener port of 127.0.0.1:3312 instead of using the 127.0.0.1:9312 that the sample sphinx.conf said was the default listener. In this scenario searches at the command line worked but not on the wiki. I changed the listener to 9312, stopped and started the search daemon and results then showed up on my wiki. 12.111.225.77 16:10, 8 May 2013 (UTC)
Change $wgSphinxSearch_port option. Unikum (talk) 18:35, 29 January 2014 (UTC)

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

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 208.206.3.254 14:11, 11 September 2012 (UTC)

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. Svemir Brkic (talk) 14:44, 11 September 2012 (UTC)
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 );
}
} 208.206.3.254 15:35, 11 September 2012 (UTC)
If you changed php.ini for all environments, you are fine. That is just a notice, not an error. Svemir Brkic (talk) 17:26, 11 September 2012 (UTC)
exellent. Thank you for your help!! 208.206.3.254 19:35, 11 September 2012 (UTC)
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)... 12.111.225.77 19:29, 8 May 2013 (UTC)
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.. 149.6.134.59 14:14, 9 July 2013 (UTC)
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 Svemir Brkic (talk) 15:11, 9 July 2013 (UTC)
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 149.6.134.59 08:50, 10 July 2013 (UTC)
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. Svemir Brkic (talk) 10:46, 10 July 2013 (UTC)

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


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.

When I just added sphinx to my wiki and with I do a search for say "conventions" where I know I have pages I get back "Results 1 - 14 of 233" for Conventions but the "View (previous 20 | next 20) are in black and can't be selected. How do I fix this. Users need to get to the next batch of 20 pages. Why is it only showing 14 (1 -14 off 233)? This is for most searches I have had a couple searches the result in "Results 1 - 20 of 143" and here I do get previous / next links down to bottom that work. I really need help with this it seem pretty random... 208.206.3.254 19:32, 25 September 2012 (UTC)

I have never encountered an error like that one. Perhaps there are some errors in your logs that may provide a clue? Svemir Brkic (talk) 02:24, 26 September 2012 (UTC)
Posting removed - wrong location. I thought the above response was to my question which is actually below. My apologies. I've seen your suggestion there and will respond to it. Mgreis (talk) 03:08, 27 September 2012 (UTC)
Those queries look OK to me. Do you get any errors when you run them directly? Svemir Brkic (talk) 03:16, 27 September 2012 (UTC)
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

"Internal error: searchd error: unknown local index" in search results

I've just installed Sphinx 2.0.5 and SphinxSearch 0.85 on a MW 16.5 installation. (I'm trying to migrate several wikis forward from MW 1.15; I can't go to 1.19 because of an upgrade problem with 1.19 in CentOS 6.0.) The Sphinx Search function works fine, selecting appropriate results, but the screen of search results displays an error instead of the highlighted extract from the wiki for each entry found:

Sustainability/NGOs
Internal error: searchd error: unknown local index 'wiki_main' in search request
11 KB (1,593 words) - 16:26, 20 July 2012

"wiki_main" is of course the default name of the wiki index in the sample sphinx.conf file. My customized sphinx.conf file no longer has an entry by that name. So where is the SphinxSearch extension picking this name up from? And is that the problem? Mgreis (talk) 02:09, 26 September 2012 (UTC)

You need to set your custom index name in LocalSettings.php using $wgSphinxSearch_index variable. Svemir Brkic (talk) 02:14, 26 September 2012 (UTC)
Thanks so much! That solved the problem. I hadn't had to set that parameter in the previous version of SphinxSearch I was using.
I relied on your very thorough installation instructions on the Extension:SphinxSearch page. Thank you for those. I went back to look at them when I read your reply to see if I'd missed something. I didn't see $wgSphinxSearch_index among the options listed there. Between that and the error message, I'm thinking that means most people don't change the default custom index name "wiki_main" in the configuration file and so don't run into this problem. I probably shouldn't have either, but I thought I might at some point index more than one wiki, so I thought it best to customize it.
Thanks for your help - and this great extension! Mgreis (talk) 14:46, 27 September 2012 (UTC)

Where is SphinxSearch_body.php "etc."

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


In step 8.2 of install you are supposed to: "Copy all remaining files of the extension (SphinxSearch.php, SphinxSearch_body.php, etc.) to your extensions/SphinxSearch directory." But the only files that come with the latest extension download are: LICENSE sphinx.conf SphinxSearch.i18n.php SphinxSearch_setup.php README SphinxMWSearch.php SphinxSearch.php

So where's SphinxSearch_body.php, let alone the rest of what's supposed to be in etc? Maximilianklein (talk) 21:20, 30 September 2012 (UTC)

This is simply an old piece of documentation - since version 0.8, the files have changed. I updated the list to the best of my knowledge. However, you don't need to worry about that - the "copy the rest of the files" part is the important bit anyway, whatever they are :-) FreedomFighterSparrow (talk) 05:03, 23 October 2012 (UTC)
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.

Seems like a bug

Found an unpleasant behavour in my wiki - when there is an interlink in a search page result, it is shown incorrectly. For example, article text is

word1 word2 word3 word4

where word2 word3 is an interlink to article word2_word3. This way an article text looks like

word1 [[word2_word3|word2 word3]] word4

and on the search page, then shown in preview, it will be

word1 word2_word3 word2 word3 word4

word2_word3, formatted as simple text, is obviously excess.
If this is my fault or there is a simple way to correct this - i will gladly appreciate any help. Quadrat137 (talk) 13:42, 3 October 2012 (UTC)

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.
Oh...
I feel a bit retard
If this is the cause i'm being ignored, i ask for your apologize..
If i'm ignored because i'm strinky or like that, just let me know, please, and i still ask for your apologize

I'm using SphinxSearch 0.7.2 with Sphinx 2.0.4 on mediawiki version 1.18.0. Quadrat137 (talk) 15:18, 16 October 2012 (UTC)

solaris 8 compile fails with logf was not declared in this scope

Trying to compile on solaris 8, can anyone help me?


MW 1.19 (latest) solaris 8 gcc


Making all in libstemmer_c make[1]: Entering directory `/var/spool/pkg/sphinx-2.0.6-release/libstemmer_c' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/var/spool/pkg/sphinx-2.0.6-release/libstemmer_c' Making all in src make[1]: Entering directory `/var/spool/pkg/sphinx-2.0.6-release/src' /bin/sh svnxrev.sh .. make all-am make[2]: Entering directory `/var/spool/pkg/sphinx-2.0.6-release/src' g++ -DHAVE_CONFIG_H -I. -I../config -DSYSCONFDIR="\"/usr/local/etc\"" -DDATADIR="\"/usr/local/var/data\"" -I/usr/local/include -pthreads -I/usr/local/mysql/mysql/include -D_FORTEC_ -Wall -g -D_FILE_OFFSET_BITS=64 -O3 -DNDEBUG -MT sphinxsearch.o -MD -MP -MF .deps/sphinxsearch.Tpo -c -o sphinxsearch.o sphinxsearch.cpp In file included from sphinxsearch.cpp:16: sphinx.h: In member function `int CSphMatchComparatorState::CmpStrings(const CSphMatch&, const CSphMatch&, int) const': sphinx.h:2461: warning: cast to pointer from integer of different size sphinx.h:2462: warning: cast to pointer from integer of different size sphinxsearch.cpp: In function `ISphRanker* sphCreateRanker(const XQQuery_t&, const CSphQuery*, CSphQueryResult*, const ISphQwordSetup&, const CSphQueryContext&)': sphinxsearch.cpp:5616: error: `logf' was not declared in this scope make[2]: *** [sphinxsearch.o] Error 1 make[2]: Leaving directory `/var/spool/pkg/sphinx-2.0.6-release/src' make[1]: *** [all] Error 2 make[1]: Leaving directory `/var/spool/pkg/sphinx-2.0.6-release/src' make: *** [all-recursive] Error 1 68.90.105.204 17:12, 24 October 2012 (UTC)

Using wildcard and stemming - displaying results, wrong snippets

Hello, I am using sphinx-0.9.9-6.4, SphinxSearch 0.8.5, MediaWiki 1.19.1, Linux Suse 11.
Everything works nice, searching in browser returns the correct pages. The structure of the results is:

page title
a part of the page text with the
highlighted search term to show the context

But when searched using wildcard * or stemming. The structure of the results is:

page title
the beginning of the page no matter
whether it contains the search term or not

Changing $wgSphinxSearchMWHighlighter, $wgAdvancedSearchHighlighting didn't do any good.
Any idea is welcome. Adam 193.179.76.222 15:32, 30 October 2012 (UTC)

I have solved the issue partially. In the sphinx.conf the stemming was done by inherited indexes.
index stemmed_en : wiki_main
{
path = /var/data/stemmed_en
morphology = stem_en
}
index stemmed_cz : wiki_main
{
path = /var/data/stemmed_cz
morphology = stem_cz
}
Meanwhile the parent index wiki_main had morphology = none.
If stem_en is done in the parent index, then the snippets for stemmed forms of English words are OK and the words are highlighted. It seems only the one local index is used for creating the snippets. But only one morphology parameter can be used in the local index, hence the snippets for Czech words are still wrong. Also the snippets for wildcar* search are wrong (I don't know why).
Any idea is welcome,
Adam 193.179.76.222 09:50, 23 November 2012 (UTC)
Sphinx 2.1.9; Sphinx Search 0.9.0; Mediawiki 1.23.
I have a wild card search problem with my installation. Wild card search doesn't show the proper snippets with highlighting. Instead the snippets content starts from the beginning of the page. Search without wildcard works fine though. Any idea on how to solve this problem? 99.126.252.65 17:45, 21 July 2014 (UTC)

search commented text

Hi

Is there a way with sphinx used in mediawiki to search into the commented text ? example: let say this is some wiki code of a page called "test":

  x y z

If I search for "alpha" or "beta", sphinx will return the page "test".

Is there such a way ? Thanks 134.191.232.70 08:14, 14 November 2012 (UTC)

Sphinx extension is indexing your wiki source, but it is stripping HTML code first. If you change sphinx config not to do that, it will index the comments, but it will also index a lot of random HTML tags. If you are usually using wiki syntax and not much HTML code, that may work for you. Svemir Brkic (talk) 13:58, 7 February 2013 (UTC)

"All words" checkbox

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


After I upgraded from a reasonably old version, one of my users noted that the "all words" checkbox disappeared. Is this functionality now contained entirely in the Boolean operators that are available? —Emufarmers(T|C) 19:25, 19 December 2012 (UTC)

Yes. Svemir Brkic (talk) 14:14, 7 February 2013 (UTC)
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.
Category:Talk pages using deprecated source tags