Last modified: 2005-05-27 14:49:02 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 2252 - Optional search engines
Optional search engines
Product: MediaWiki
Classification: Unclassified
Search (Other open bugs)
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
  Show dependency treegraph
Reported: 2005-05-26 16:59 UTC by Matt Hart
Modified: 2005-05-27 14:49 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description Matt Hart 2005-05-26 16:59:54 UTC
Allow for users to create alternate search engines. The method I'm using is to 
modify index.php to make this:
 require_once( 'includes/SpecialSearch.php' );
use a variable:
 require_once( $wgSearchPage );

That I setup in LocalSettings.php:
 # $wgSearchPage = "includes/SpecialSearch.php";
 $wgSearchPage = "includes/SpecialGSearch.php";

The main function call remains the same, thus minimally affecting the scripts.

I'm creating a google-style syntax search with ranked results for the wikis that I 
admin (I've already created, um... 4 or 5 of these for other projects? Something 
like that...)
Comment 1 River Tarnell 2005-05-26 17:38:58 UTC
you can already do this.  look at extensions/LuceneSearch.php in CVS. 
Comment 2 Matt Hart 2005-05-26 19:01:07 UTC
Lucene doesn't handle phrases... but I'll try working with it first.
Comment 3 River Tarnell 2005-05-26 19:40:49 UTC
what is a search phrase?  you can do whatever you want with the search term 
provided to your search page - it's just another special page, plus 
Comment 4 Matt Hart 2005-05-26 19:59:40 UTC
"find this phrase" is a search phrase. If I use Lucene search on Wikipedia for this:

"san jose"

it will find anything with "san" or "jose" - including "San Francisco" or "sands of time"

If I use "san jose" on Google, it will only find pages with the words "san jose" next to each 
Comment 5 River Tarnell 2005-05-26 20:53:26 UTC
that's a function of the implementation of SpecialSearch, not something particular 
to the page itself.  if you don't want to use Lucene, you don't have to - as long 
as your special page uses the same interface, it can do the search itself however 
it wants. 
Comment 6 Brion Vibber 2005-05-26 21:23:03 UTC
I've already started reworking the SearchEngine backend in CVS HEAD. The new MWSearch 
extension provides the Lucene backend for this working on the main frontend; you could do any 
other sort of backend engine the same way.

(There will be a few additional tweaks to it to spiff up the frontend still.)

Second, I don't understand the claim about phrase search; the Lucene search *does* do phrase 
searches when you quote them. I'm not sure whether the claim is actually about quoted phrase 
searches or about the inclusive vs conjunctive search style; at the moment our Lucene search 
defaults to 'or' searches so it will returns hits matching any of the given terms (where 
terms may be words or quoted phrases) rather than requiring all of them. Since this is 
generally annoying, it should at some point be fixed up as we did for the MySQL 4 boolean 
fulltext search to require all terms to be present in matches. That however is totally and 
completely unrelated to the request of this bug and I don't understand why it's been brought 
up here.
Comment 7 Matt Hart 2005-05-26 21:36:07 UTC
I wasn't being clear - I meant that the extension doesn't do phrase searching. It also doesn't 
appear to do the type of ranking I'm attempting... and all of this is secondary to the 
request - I was only looking for a way to extend the search by modifying only LocalSettings. 
Creating my own search functionality is straightforward.
Comment 8 River Tarnell 2005-05-26 21:41:23 UTC
yes; you can do this already.  create a special page and use it in local settings 
like normal.  look at LuceneSearch.php for an example of how this is done. 
Comment 9 Matt Hart 2005-05-27 13:20:37 UTC
I want to change the default search - not add a new one. As far as I can tell, this can only 
be done by modifying index.php.
Comment 10 River Tarnell 2005-05-27 13:33:38 UTC
the only thing you seem to be doing in the example in the initial comment is 
replacing the Special:Search page with something else. 
if this is not what you want to do, could you please clarify? 
Comment 11 Matt Hart 2005-05-27 14:21:38 UTC
Perhaps I don't understand the software well enough... but if I search using the main page's 
keyword entry box, the search uses SpecialSearch.php. I don't want it to use that - I want it 
to always use my specialsearch page. I don't want to overwrite SpecialSearch.php, either - I 
want to minimally affect the scripts and only make changes to LocalSettings.

Sure, I could replace SpecialSearch with my own version of it - but I want to avoid 
overwriting existing scripts.
Comment 12 River Tarnell 2005-05-27 14:34:31 UTC
the wiki page "Special:Search" is not inherently tied to the file 
"includes/SpecialSearch.php", it just uses that by default.  by including (as an 
extension) your own page that provides an implementation of Special:Search, and 
setting $wgDisableInternalSearch, you can replace Special:Search with anything you 
want -- no need to overwrite any files.   
this is how LuceneSearch works;  it's an extension, does not modify the MediaWiki 
code at all, but replaces the built-in MySQL search with its own (Lucene-based) 
Comment 13 Matt Hart 2005-05-27 14:49:02 UTC
That does it - much appreciated!

Note You need to log in before you can comment on or make changes to this bug.