Manual talk:$wgEnableMWSuggest

From MediaWiki.org
Jump to navigation Jump to search

Usage???[edit]

This worked for me under MediaWiki 1.13alpha:
$wgEnableMWSuggest = true;
$wgMWSuggestTemplate = "http://www.example.com/wiki/api.php?action=opensearch\x26search={searchTerms}\x26namespace={namespace}";
Change www.example.com to your own domain and /wiki/ to your $wgScriptPath. --Sayuri 20:51, 17 August 2008 (UTC)
You don't need to set $wgMWSuggestTemplate anymore in MW 1.13.0: the suggestion template is set to a reasonable default value. Maiden taiwan 02:48, 19 August 2008 (UTC)
Also be sure that $wgEnableAPI is not set to false and that you use 1.13. iAlex 20:54, 17 August 2008 (UTC)
I'm not able to get it working either. Are there any known conflicts that I should be aware of? Joezoo 14:40, 3 September 2008 (UTC)
(By the way, I'm using LuceneSearch on MW 1.13 with MWSearch installed. $wgUseAjax and $wgEnableMWSuggest are both set to true.) --Joezoo 14:52, 3 September 2008 (UTC)
Never mind! I got it working! Turns out, when I updated from the last version of MediaWiki, I didn't copy the new contents of skins/common, which included the mwsuggest and new ajax files. But now it's working! --Joezoo 15:38, 3 September 2008 (UTC)

Features?[edit]

Apart from the first character, this seems to be case-sensitive, which is a pity - who uses uppercase in search terms? Any way to get this case-insensitive? (don't know how to get this username-and timestamp - there are no edit-buttons here and it's not obvious where to look on Help:Editing - sorry.)

There's Extension:TitleKey to make suggestions case-insensitve (enbaled on Wikimedia wikis). iAlex 17:32, 20 November 2008 (UTC)
cool, thanks - it works. Would be even cooler to have arbitrary substring matching and additional Namespaces. (and the editing buttons are back so here's my sig :) --Heiko Haller 19:07, 20 November 2008 (UTC)

How to remove search suggest terms?[edit]

I'm relatively new to mediawiki so I accidentally created a page with an "&" symbol in it. Naturally, this created a truncated page title. However, in the search suggest dropdown it indexed it with the entire title including the "&" in it. I've modified the page to spell out "and" instead. But, the search suggest term remained (with the original "&" symbol in it). I tried deleting the record in the _searchindex table of the database, but it didn't affect the search suggested terms. Anyone know how to get rid of it? --Hahn73 20:51, 11 March 2009 (UTC)

Figured it out. In case anyone else needs to know - you need to delete the record from both the searchindex table AND the page table. --Hahn73 21:32, 11 March 2009 (UTC)

To delete a record from the page table is quite risky! In your specific case it was not necessary: after you move the page to the new title, just delete the old title (that has now become a redirect page) and it will disappear from the searches. Capmo 17:18, 30 March 2009 (UTC)

Extend the search[edit]

Can this be extended to search more than just the first word in a title?

For example, I'm looking for an article titled Pixar's Disney Toy Story

However, all I know is that Disney had some part in Toy Story.

I would start typing Dis.. and realize that nothing is coming up in the ajax search.

Is there a way to set the index to index more? Or another work around to do more?

Thanks

For these situations there is already the Search button, that will locate the typed word inside titles and pages. Capmo 17:24, 30 March 2009 (UTC)
And you may, of course, use redirects for alternative or incomplete terms... -- 85.181.27.9 06:43, 22 May 2009 (UTC)

I posted this problem as #20237. --Wissenslogistiker 08:58, 14 August 2009 (UTC)

Note that how the results are generated has nothing to do with $wgEnableMWSuggest and mwsuggest.js. What you probably want is a new extension that will override the default prefix backend (similar to Extension:TitleKey) and provide those additional results. However, I think you will find that unless your wiki is extremely small, this feature can be rather annoying, since in most of the cases, you don't want to see all the titles in alphabetical order that might have "dis" somewhere in them, or even titles where some word begins with dis. --Rainman 17:34, 14 August 2009 (UTC)

Adding Namespaces[edit]

How does one change/add namespaces for the MW Suggest engine to search? My wiki relies heavily on categories and would like the Suggestion tool to list them. Could anyone post a working example of the code needed to add them Please?

The namespaces that appear in suggestions are those that are either default (for anon users), or those from user preferences (for logged-in, Search tab in preferences). However, for performance reasons, this multiple-namespace suggestion feature has been turned off in TitleKey extension in revision 35607 (Special:Code/MediaWiki/35607). This has been hardcoded and is not configurable, and the only way to enable it presently is to revert this revision (or by checking out an earlier version of TitleKey). If you with to work on a patch to make it configurable, please do, and submit to bugzilla. :) --Rainman 18:45, 23 April 2009 (UTC)

Size of box[edit]

Although not directly related to EnableMWSuggest, I don't know where else to ask. I noticed on wikipedia the search box gets bigger and shows the full article name where as my wiki only displays the size of my search box and "..." if its too big. How do I increase the size of the search suggestions to be longer than the search box? --Bluesoju 14:18, 30 June 2009 (UTC)

This is a feature present in current development version of MediaWiki. Since you probably don't want to upgrade whole of your mediawiki until the new official release you can just copy the latest version of mwsuggest (e.g. from mediawiki.org) to your installation and use it until the new release. --Rainman 17:15, 30 June 2009 (UTC)
You have to add the following to you MediaWiki:Common.css 178.7.106.59 12:55, 29 April 2011 (UTC)

#simpleSearch input#searchInput {
    width:20em;
    }

How to enable in 1.15?[edit]

Doing some searching I set:

$wgEnableMWSuggest = true;
$wgOpenSearchTemplate = true;

in LocalSettings.php

I also tried commenting out:
//$wgScriptExtension = ".php";

I just want to get the search bar suggestions to work. I believe this is supposed to be core functionality. How do I enable this?

Thanks.

It is a core functionality and should work (even without $wgOpenSearchTemplate = true;). Did you enable ajax? If not, simply add $wgUseAjax=true; in yout LocalSettings.php--Gregra 21:16, 2 September 2009 (UTC)

I tried this all but it won't work?


  • When I change $wgScriptPath in LocalSettings.php, the AutoSuggest quits working.
  • I am using IIS and our DNS CNAME record points directly to the /wiki folder.
  • All of the pages show up find with $wgScriptPath = "/.", but like I said the AutoSuggest no longer works. Any idea why or is there a workaround?

Jeremytmunn 16:22, 21 October 2009 (UTC)

I had this same problem. I opened the error console of Firefox and discovered that svn had messed the merging of some of the javascripts. I got a fresh copy of skins/common/ and the problem was fixed.--JonathanWilliford 22:22, 2 August 2010 (UTC)

MWSuggest broken in 1.16x[edit]

After updating to the current trunk version, mwsuggest seems to be broken. There is, however, a JS-error:

Line: 389
Error: document.forms[...].elements is null or no object.
Code: 0
URL: Special:Search

-- docMario, 02.08.2009, 22:59CET Addition: with the recent nightly dump, mwsuggest seems to work again. The error still occurs on the Special:search page with the "advanced" option activated. -- docMario, 14.08.2009, 03:10CET

$wgEnableMWSuggest shows only part of the articles[edit]

Hi, if I create many categories, than when I type "category:" it shows me in the suggest just part of the categories in alphabetic order. How do I define that the suggestion shows all the articles?

--Gregra 22:23, 5 August 2009 (UTC)

New Search Bar on site[edit]

i put a new search bar on my site it works but mwsuggest works sometimes.

1.17 search release[edit]

I can't get my search suggest to work anymore in the 1.17 version. It used to work in 1.15. Is there anything new I have to modify?

Search goes out of screen[edit]

I'm running the latest mediawiki with default vector skin, however, when i search for something with mwsuggest enabled the suggestions come up, but resize the screen in width to the right instead of aligning to the right corner like on the mediawiki. Am i really the only one with this issue?

Hiding Redirects[edit]

Is there an option or extension which hides redirect pages from the suggestions list? My wiki has quite a lot of them and they tend to clog it up, making suggestions almost useless. --Resplendent 01:12, 2 January 2011 (UTC)

I also would like to hide redirects from the suggestion list. I goggled a lot and found a discussion about this on bugzilla. It seems that the change was proposed but not implemented in the end. You can click on "diff" next to "proposed patch" to see the necessary changes. Does anyone have another solution? If not I will try to adapt my code like proposed. --Stefahn 16:48, 10 January 2011 (UTC)

Question[edit]

Is there any way to put the suggestions to appear when I type in all lowercase? For exemple:
If I type "The Stone" appears. If I type "The stone" disappears.
And, to take off redirects suggestions?
--MatheuszFelipe 21:19, 19 April 2011 (UTC)

Problem[edit]

I am using MW1.16.2 and a custom monaco skin, i have followed the steps in the page and when things are typed into the search box suggestions come up but when they are selected I am taken to a blank search page and the search title in the page URL. Even typing in pages that don't exist takes you to a blank search page.

Localsettings.php reads as this:

$wgEnableMWSuggest = true; $wgOpenSearchTemplate = true;

Am I missing something? 203.51.68.110 13:06, 23 April 2011 (UTC)

Number of suggestions[edit]

How can specify the number of suggestions which are shown below the search box? If I enter "E" in my search box I won't get all articles starting with "E". :-(

In "/skins/common/mwsuggest.js", there is a parameter window.os_max_lines_per_suggest = 7; . --Kipmaster 14:28, 9 December 2011 (UTC)

Line 38 in the mwsuggest.js file: window.os_max_lines_per_suggest = 7; //it does not go above 10 lines

Is there any way to circumvent this very low limit? 2013-02-04

Speed of Suggestions[edit]

Is there any way to show this suggest faster? it usually takes good 2-3 seconds for it to populate, but it'd be ideal it starts off the bat.

Anyone know how to do this?

The suggestion from Extension:Vector is much faster! (the default suggestion algorithm is automatically replaced when the extension is installed). --Kipmaster 14:19, 9 December 2011 (UTC)

change the location on the search suggestions[edit]

Please how can I change the location on the search suggestions , as I am using custom skin and I want to modify the location of the search suggestion --Mohamed Ouda 00:07, 29 July 2011 (UTC)

Error on page in MW 1.18?[edit]

After a fresh installation of MW 1.18.2, this AJAX search completion is enabled by default. When however I start to type the first letter into the search box, there is an error on page:

Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)
Timestamp: Wed, 9 May 2012 09:26:29 UTC
Message: 'config.$region.offset().top' is null or not an object
Line: 25
Char: 925
Code: 0
URI: http://{SERVERNAME}/load.php?debug=false&lang=en&modules=ext.gadget.Edittop%2CNavigation_popups%7Cjquery.autoEllipsis%2CcheckboxShiftClick%2CcollapsibleTabs%2Ccookie%2CdelayedBind%2ChighlightText%2CmakeCollapsible%2CmessageBox%2CmwPrototypes%2Cplaceholder%2Csuggestions%2CtabIndex%7Cmediawiki.action.watch.ajax%7Cmediawiki.language%2Cuser%2Cutil%7Cmediawiki.legacy.ajax%2Cwikibits%7Cmediawiki.page.ready&skin=vector&version=20120509T091208Z&*

This error causes the <ENTER> not to work, so pressing <ENTER> does not trigger any action. I have to manually click 'Search' to start the search option. Any idea what causes this? It took some time to find, but this bug report has more info on the topic.

Why don't imported pages appear in the auto-suggests?[edit]

I imported several hundred wiki pages using the Import pages feature and none of those pages show up in the auto-suggest box.

Is there a reason for this? Perhaps they'll eventually show up but it's just taking a while? Does anyone have suggestions on how to fix this? It'd be terrible if auto-suggest only worked for manually created pages.

I found an answer. After manually importing pages, they aren't necessarily added to be searched. I believe you have to run two scripts: updateSearchIndex.php and rebuildtextindex.php.
However, you need to specify a few parameters for updateSearchIndex.php such as a starting date. The below command worked for me
"php maintenance/updateSearchIndex.php -s 20081020224040"
I was only interested in getting the page titles to come up as searchable in the auto-suggest, so I think the updateSearchIndex.php did the trick for me. The date used is some random date that's before when I imported pages but if you have an older wiki you may need to make a modification.

Mediawiki 1.20[edit]

Apparently this feature is removed from 1.20. How do I enable anything similar with monobook skin? DonPaolo (talk) 13:51, 7 November 2012 (UTC)

Hi DonPaolo : I just added "$wgEnableMWSuggest = true;" to my wiki's localsettings.php and it works - try adding this to your LocalSettings.php and let everyone know whether it works or not - Thanks (for me it is working).
No, that setting is removed from 1.20. Actually I could get the feature work without it. DonPaolo (talk) 13:00, 15 November 2012 (UTC)

Namespaces in suggestions.[edit]

I'm trying to configure my search box to include content pages from two namespaces as suggestions. I've added the namespaces to $wgNamespacesToBeSearchedDefault which works correctly in regular search and also enabled $wgEnableMWSuggest which also works. There is a topic further up this page that seems to indicate that this isn't possible but it's been done over at UESP.net. Does anyone know how to do this? If it helps this is the wiki and here is an example search that includes both namespaces in the search results. Thanks in advance. --Valadez (talk) 22:05, 23 February 2013 (UTC)

For reference we (uesp.net) ran into the same issue after upgrading from 1.19 to 1.22. It seems that the namespaces to be searched for a suggestion is now hardcoded into line 179 of resources/mediawiki/mediawiki.searchSuggest.js (or resources/src/mediawiki/mediawiki.searchSuggest.js in later MW versions). Our temporary fix was to simply edit this file and insert our default namespaces in. -- Daveh@www.uesp.net -- 72.39.63.156 15:02, 9 June 2015 (UTC)

1.25.3, this setting is removed but searching isn't there.[edit]

Started [1] if anyone cares to comment. Timneu22 (talk) 02:51, 14 November 2015 (UTC)

Needed to disable the Vector extension. Hopefully this will help someone else. Timneu22 (talk) 03:09, 14 November 2015 (UTC)