User blog:Eladkse/A Fix For Search

Update: 11 May 2012 The code has been updated to work with the new version of Special:Search. Enjoy!

Last week, Wikia released an update to the search function, which meant that using the searchbar took you to a list of results instead of a matching page. The reason for this is simple: to make searching for terms which are also page names easier.

Like many changes on this site in the past few years, this has proven rather controversial, with many users preferring the old system of 'search and go'. To fix this, and show that the Oasis searchbox could work better with both 'Go' and 'Search' buttons, I created a bit of JavaScript that adds a second button to the searchbar and restores the default enter key function.

You may already be aware of this code thanks to various blog comments. However, I thought I'd make a blog about it, as there seems to be a lot of confusion about various aspects.

What it does
As I said before, the code makes two changes to the search bar:
 * It adds a second button (the one with the arrow), which takes you to a page whose title matches the search term, if it exists. Essentially, as it was before the change.
 * It changes the functionality of the enter key, so that is performs the same function as before.

Usage
Let's make this clear first. This code is for personal use only. This means it can only be used on your own personal global script page.

This code cannot be applied wiki-wide, as it violates Wikia's Terms of Use, which state:


 * You further agree:
 * Not to intentionally block, remove, or otherwise obstruct the proper functioning and view of advertisements, and/or user interface and functionality by other users, including but not limited to changing or adding JavaScript or CSS changes to the Service that would prevent the proper display or function of advertisements and/or user interface and functionality;

In short, the default search for the other users of a wiki should not be changed, even if there is a community consensus.

Installation
Now here comes the fun part! To install the code, edit your personal global.js page, and add the following to the top:

importScriptPage('SearchGoButton/code.js', 'dev');

Save the page, then clear your cache. This is very important. I have seen many users remove the code immediately after adding it because it 'doesn't work'. Just give the server time to catch up.

Help and comments
Leave a comment below if you are still having trouble, and I will try to help you as best I can. Please do not use the comment section this blog to complain about the changes. Direct these complaints instead to Dopp's blog post.