Extension talk:GoogleSiteSearch/LQT Archive 1

Can't support the asian language
Can't be used in an asian language wiki. --86.208.100.41 15:30, 27 April 2008 (UTC)

I installed the Extension on A+医学百科(An Chinese Medical Wiki), setting $wgGoogleSiteSearchVars['ie'] and $wgGoogleSiteSearchVars['oe'] to 'UTF-8', $wgGoogleSiteSearchVars['hl'] to 'zh', then it works fine.

GoogleSiteSearch not working on internal site
I've installed this extension on 1.11.2 version of MediaWiki. I am unable to get any results for search. My company is hosting the wiki as an internal site. Would there be a special setup required in this case? Or is it even possible to use GoogleSiteSearch for this?

--Jenn 20:22, 7 March 2008 (UTC)

I've run into the exact same trouble as mentioned by Jenn above. Internal company CMS-wiki and tried to add a better search engine. No search results whatsoever. Any suggestions/solutions/tips would be greatly appreciated.

--carsten3m 13:55, 20 March 2008

This search extension can only report what Google can see. Google (thankfully!) can't see inside your company's firewall.

--ChrisRing 18:18, 21 March 2008 (UTC)

I really like this implementation of Google Search! We recently bought a Google Mini search appliance and was wondering if there is a way to get this extension working with our own search box instead of the public Google search? Anyone attempted this yet?

--Rob Matzker 18:51, 22 April 2008 (UTC)

I've amended this extension to work with our internal Google search service (as well as the regular Google service), and parse XML rather than using an iFrame. I will try and post it once my company gives me permission.

Biyer 18:32, 22 October 2008 (UTC)

I have similar problem here. I can't find any search result about an existing page. I use dreamhost.com as my server. Is it because I haven't add url to google?

--Coulomb 15:39, 30 December 2008 (UTC)


 * My problem is solved. It is not about firewall or internal website. My problem is that I didn't add the my url to google so that google can't see my website. After 2 weeks of sending my url, google can see me now. --Coulomb 09:39, 14 January 2009 (UTC)

Is there any update on this or does anyone know of a search that works as good as this one but only for internal wikis?

--Zetsumei1920 08:44, 31 December 2008 (PST)

Searching Just the Wiki
Alright, I'm sure this is very simple, but I'd rather not meddle if I'm unsure about something. I'd like my GoogleSiteSearch extension to search only the wiki on my website. The link below shows that it actually picks stuff up from the deeper levels of the site. While its not a big deal, it could be distracting for users. http://www.arcandio.com/wiki/index.php5?search=blade&fulltext=Search

Is it possible to use the first two search variables to direct SiteSearch just to the /wiki folder? or is google too awesome for me and can only search the entire thing?

Much appreciated. Very slick extension I must say.

--Arcandio 00:25, 25 March 2008 (UTC)

Still seeing ads with non-profit Coop Account
I got this extension to work right out of the box, but with one small problem. I work for a non-profit and setup a coop account (aka custom search engine) at Google. As a non-profit, I can request no ads on my Google search results.

However, in the code snippet that Google gives me, it doesn't tell me a "client" id, but rather a "cx" id. The cx id is of the form "21digitNumericString:11CharacterAlphanumericString".

No matter what I try I get ads on my search results. I've tried replacing client with cx, sending identical cx and client strings, sending only the first or second part of the cx ID. I always get ads.

Any ideas?

Thanks,

Tnabtaf 15:00, 10 August 2008 (UTC)

I got this to work by putting "pub-" in front of my CX id, and passing the whole thing in as a client string.

Tnabtaf 15:17, 10 August 2008 (UTC)

Can the page show "create this page", when there is no matching result found?
When clicking "Go" and there is no matching result, I can see there is a link "Create this page". But if I click "Search" and there is no matching result, there is no "create this page" link on the page. How can I change it? I want to see "create this page" both clicking "Go" or "Search". Thank you!


 * I edited MediaWiki:Searchsubtitle, by adding:

create this page
 * It works, but the font is very small. I think a better place to add this text should be MediaWiki:Searchresulttext, but I have no idea to make $1 turn into search keyword here.

1.14
How do you install it in 1.14? The part of SpecialSearch.php mentioned has changed. I have

public function showResults( $term ) { global $wgOut, $wgUser, $wgDisableTextSearch, $wgContLang; wfProfileIn( __METHOD__ ); and function showResults( $term ) { wfProfileIn( __METHOD__ ); global $wgOut, $wgUser; $sk = $wgUser->getSkin;

that might be something. But function showResults( $term ) { $fname = 'SpecialSearch::showResults'; wfProfileIn( $fname );

does not exist. Thanks. Tempp 04:01, 3 April 2009 (UTC)

1.14 Call for help
I am trying to install this in my wiki (v1.14) I have the same problem Tempp has, the code in SpecialSearch.php does not match the example in the extension page. I noticed the author of the extension has not responded to any messages on this page and was wondering if anyone else is working on this extension. If so Please let me know. Thanks in advance --Jake4d 06:01, 12 May 2009 (UTC)

1.14 solution
To use this extension with version 1.14 add

wfshowResultsGoogle( $term ); return;

at the begining of the function starting by (hint, this is found at or near line #926)

function showResults( $term ) { wfProfileIn( __METHOD__ ); global $wgOut, $wgUser; $sk = $wgUser->getSkin;

so it looks like this

function showResults( $term ) { wfshowResultsGoogle( $term ); return; wfProfileIn( __METHOD__ ); global $wgOut, $wgUser; $sk = $wgUser->getSkin;


 * It works! Thanks. --Jake4d 18:11, 17 May 2009 (UTC)

I am using Mediawiki 1.17 Can you please please tell me where to edit this code in SpecialSearch.php as I am able to see the google result but from the web not from my wiki. Help much appreciated. Thanks--146.162.240.241 10:16, 6 September 2011 (UTC)

UTF-8
I changed $wgGoogleSiteSearchVars['ie'] = 'ISO-8859-1'; and $wgGoogleSiteSearchVars['oe'] = 'ISO-8859-1'; to UTF-8 when I installed this extension on debatrix and have found no problems with it whatsoever. --Jake4d 01:58, 15 June 2009 (UTC)


 * I have the problem. How can I resolve it. I have a German wiki with ä, ö, ü ??? Fabio 80.218.141.182

Browser Issues
Upon adding this extension to my wiki, I discovered some slight browser issues. While this extension worked okay in Mozilla Firefox; when using Internet Explorer, the search results would not appear. This probably had something to do with the browser settings, but I couldn't figure out how to fix it. The suggested work around is:


 * 1) Open Google on the internet explorer browser.
 * 2) Search for the wiki using Google.
 * 3) Open the wiki, and then perform a search.

Any subsequent searches would perform fine. Also, this issue only appeared if the user was not logged in. The searches would perform perfectly if the user was logged in.

Problems with MediaWiki 1.15.0
The codes of page  have changed in MW 1.15.0. So how is the proceed now to make it work? Chernobyl 21:03, 2 July 2009 (UTC)
 * Edit: The same solution applied below for 1.14 works for 1.15 too ;) Chernobyl 17:05, 6 July 2009 (UTC)


 * This doesn't seem to work for me, in 1.15.1. I followed the same instructions as for 1.14.0.  My SpecialSearch.php now looks like this:

public function showResults( $term ) { wfshowResultsGoogle( $term ); return; global $wgOut, $wgUser, $wgDisableTextSearch, $wgContLang; wfProfileIn( __METHOD__ ); ...
 * but search still gives the default MW search page.  I know I did the "require_once" part right in LocalSettings.php because I had a typo at first and it gave me an error message until I fixed it.  -- gonzoron@h_o_t_m_a_i_l.c_o_m  (remove _'s for email address)
 * It works with 1.16.0.


 * Doesn't work with 1.15.5-1~bpo50+1 (that is, version 1.15.5 from the Debian Lenny backports repo); it looks the same as 1.15.1 as above. Is this likely to ever work?  My sysadmin is already annoyed that I had to go to backports to get up to 1.15.5 :-) 24.144.209.169 19:04, 2 June 2011 (UTC)

Add Google Custom Search Engine?
Could you please add the ability for us to configure the extension to use the Google 'Custom Search Engine'? (google.com/cse/) The reason is that CSE allows us to gather statistics on the searches performed. --Choshi 13:58, 23 August 2010 (UTC)

There are two functions called showResults you need to edit the correct one for it to function. --72.177.37.131 16:19, 30 December 2011 (UTC)

Using Google Custom Search Element instead
We were getting an error from Google saying that we "may be sending out automated queries".

I fixed this by switching to use the new Custom Search Element. To use this technique you need your own API key.

So, I did changes in extensions/GoogleSiteSearch/GoogleSiteSearch.php. Replace YOUR_API_KEY with your key.

# Assemble the output $wgOut->AddHTML('   Google site results  Loading    google.load("search", "1", {language : "en"});  google.setOnLoadCallback(function { var customSearchControl = new google.search.CustomSearchControl; customSearchControl.enableAds("pub-0015062076215825"); customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET); customSearchControl.setLinkTarget(google.search.Search.LINK_TARGET_SELF); customSearchControl.draw("cse"); customSearchControl.execute("'.htmlspecialchars($term).'"); }, true);  ');

You can see this in action here: wiki.ilovefreegle.org. The above code is used when you use the Search box on the left. We also have a separate custom search box on the Front Page. If You want add You Google partner pub id to make reveniu from ads edit the line customSearchControl.enableAds("pub-0015062076215825");

Safe Search
Thanks for the above method. It is working for me - however, I wanted to know how I can enable safe search? If someone searches certain keywords, they are getting Google Ads which are X-Rated and other variations. I have the ads linked to my Adsense account, however my Adsense says that the Search ads are not relevant for this.

Example: My Site's Search Result for the query sexy. Please note the ads.