Extension talk:SphinxSearch/LQT Archive 1

fails because trying to search non-existent table Zebee Johnstone 01:48, 26 September 2007 (UTC)
Set up as described, but the table names in the version I have, MediaWiki 1.11 are: +--+ +--+
 * Tables_in_wikidb |
 * mw_archive      |
 * mw_blobs        |
 * mw_brokenlinks  |
 * mw_categorylinks |
 * mw_cur          |
 * mw_hitcounter   |
 * mw_image        |
 * mw_imagelinks   |
 * mw_interwiki    |
 * mw_ipblocks     |
 * mw_links        |
 * mw_linkscc      |
 * mw_logging      |
 * mw_math         |
 * mw_objectcache  |
 * mw_old          |
 * mw_oldimage     |
 * mw_querycache   |
 * mw_recentchanges |
 * mw_searchindex  |
 * mw_site_stats   |
 * mw_user         |
 * mw_user_newtalk |
 * mw_user_rights  |
 * mw_validate     |
 * mw_watchlist    |

so it isn't finding "wiki-page" ERROR: sql_query: Table 'wikidb.wiki_page' doesn't exist (DSN=mysql://wikiuser:***@localhost:3306/wikidb).

So which of my tables are the equivalents you are searching?


 * I believe you are getting this error when trying to run the Sphinx indexer or search tools? If that's the case then you missed a step in the instructions. In step 2, when you create the sphinx.conf file, you need to make sure to replace all instances of wiki_ with whatever your table prefix is (in your case, it looks like mw_). That's what I was trying to explain the the text after the sphinx.conf content listing. Please let me know if I should rephrase that paragraph. --Gri6507 12:02, 26 September 2007 (UTC)

Improving the index and searching speed
First of all, thanks for a great new extension. Installation was a breeze. My only problem so far was the speed of the special page itself. Here is what I changed, making the indexer faster as well:

In the sphinx.conf file:

sql_query = SELECT old_id,old_text,page_id,page_title,page_namespace \ FROM `page`, `revision`, `text` \ WHERE old_id=rev_text_id AND rev_id=page_latest AND page_is_redirect=0
 * Replaced sql_query with:

sql_group_column = page_id
 * Added one more attribute to avoid complex joins in the search page:

sql_query_info = select old_text,page_title \ FROM `page`, `revision`, `text` \ WHERE rev_text_id=$id AND rev_page=page_id AND old_id=$id
 * Replace sql_query_info (note that is used only for command-line searches, not on the search page)

In SphinxSearch.php:


 * Find the foreach at about line 167 and replace the lines from "foreach... until "$wiki_path = Title::makeName($row[1], $row[2]);" with:

foreach ($res["matches"] as $doc => $docinfo) { $sql = "select old_text FROM `text` WHERE old_id=$doc"; $res = $db->query( $sql, __METHOD__ ); if ($db->numRows($res)) { $row = $db->fetchRow($res); $title_obj = Title::newFromID( $docinfo['attrs']['page_id'] ); $wiki_title = $title_obj->getPrefixedText; $wiki_path = $title_obj->getPrefixedDBkey;

Svemir Brkic 13:59, 26 September 2007 (UTC)

Failed at step 7
Everything worked fine up to step 6

Having require_once( "$IP/extensions/SphinxSearch.php" ); in the localsettings.php brings up the following messages (PHP errLogFile)

PHP Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of [runtime function name]. If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in E:\- Daten -\- MyWebSite -\HydroWiki\extensions\SphinxSearch.php on line 88

and

PHP Fatal error: Cannot redeclare class UnlistedSpecialPage in  wikiroot\includes\SpecialPage.php on line 703

Can you furthermore comment on $wgSphinxSearch_index = "wiki"; Has it to be replaced by the sphinx.conf file or by one of the generated indexes?


 * The original code uses a pass-by-reference in one place. Alternative version below does not do that. $wgSphinxSearch_index needs to have the name of one of the generated indexes, as specified by a line such as "index wiki {" in the sphinx.conf file. Svemir Brkic 12:32, 5 October 2007 (UTC)

Alternative version
Modified version of this extension is currently in use at the New World Encyclopedia. Changes are explained at the above link and all the source files are linked from there too. Feel free to comment/use any of the code and let me know if I am not attributing somebody properly. Thanks. Svemir Brkic 03:35, 5 October 2007 (UTC)