This is the good old googleSearch component with one key difference: it uses Google's new Custom Search Engine (CSE) at the backend.
The latest component for Joomla 3.0 (v3.0.2) has been updated with Google's latest Custom Search Element v2. The new version offers:
- Custom Search components are rendered based on settings stored on the CSE servers (along with any client-side customization).
- All JavaScript is loaded asynchronously, so page load time is reduced.
The googleSearch (CSE) Module
There is an accompanying googleSearch (CSE) Module: googleSearch (CSE) module
The module allows you to add an additional Google search box as a module. This means that you can place the search form in any module position you like. When the user clicks the search button, the search result will be displayed in your Joomla main body by the googleSearch component.
Very Important - the Google CSE ID
Please make sure you have set up a Custom Search Engine in your Google's account before you can use this component. Once you have created a Custom Search Engine, Google will assign a unique CSE ID to that engine. You need to enter the CSE ID into the config page to start using this component.
For more details, please refer to the following article: Where to find the Google CSE ID?
Latest Version
v3.0.7 (for Joomla 3.0 and above)
Released Dec 23, 2016
- Support for https - resolved one more Mixed Content warning in the "Powered by Google" image
- Changed the installation method back to "Upgrade" so that you now do not need to uninstall before installing the new version. If the 2 new fields are not found, the program will automatically add the 2 new fields.
v3.0.6 (for Joomla 3.0 and above)
Released Dec 14, 2016
- Added new parameter:
use_https
. Set this to "Yes" if your site is using https. Default is "No". This resolves the mixed content warning if you are using SSL certificate for your site - "Mixed Content: The page was loaded over HTTPS, but requested an insecure script 'http://maps.googleapis.com/maps/api/js?key=...'. This request has been blocked; the content must be served over HTTPS." - Added new parameter:
open_link_in_same_window
. Set this to "Yes" if you want links to open in the same window. Default is "Yes". If set to "No", links will open in a new window.
Note:
- For this new version, you have to uninstall the old version first and re-install the new version - so that the 2 new parameters can be added.
- You may want to print or take note of the original settings first before you uninstall.
- I find it easier to open the page of the googleSearch Config in the browser, do the uninstall and re-install, open the Config page in a new browser window, and then you can copy and paste the settings from the old to the new page.
What's exciting about Google's new Custom Search Engine (CSE)
There are many exciting new features in Google's new Custom Search Engine (CSE). Here are just some of them:
- Search multiple sites. If you have set up three different sites, say site1.com, site2.com, and site3.com, the CSE now allows you search only within these three sites.
- Refinements: Refinements are labels that you apply to websites. They appear as a list of links above search results, offering users a way to narrow their search. When a user clicks a refinement label, the sites that you have labeled are given priority in the results. In addition to labeling sites, you can also specify additional words that are added to users' queries when they click a label, providing even more targeted results.
You can see a live demo of refinements on this site. Enter a keyword, say "menu" in the search box at the top-left navigation area. Did you see the 8 refinement labels there: "PHP-GTK2", "Joomla", "PHP-GTK2 sample codes", "Joomla forum articles", etc. Try clicking on any of these refinement labels. It's pretty cool!
There are many other exciting and advanced features in Google's new Custom Search Engine.
You can see the complete official Google document here: http://www.google.com/coop/docs/cse/
Differences between googleSearch (CSE) and googleSearch components
- googleSearch component: uses the traditional Google Search API.
- googleSearch (CSE) component: uses Google's new Custom Search Engine (CSE).
For this component, you can just install and use right away. You do not even need a Google Adsense ID.
For this component, you'll have to first set up a Custom Search Engine in your Google's account. Once you have created a Custom Search Engine, Google will assign a unique CSE ID to that engine. You need to enter the CSE ID into the config page to start using this component.
Demo
The search on this site is using the googleSearch (CSE) component/module. You can test it at the top of this page.
How to install
Set up is as easy as 1-2-3:
- Install the component
- Enter your Custom Search Engine's unique identifier (cx) - Where to find this?
- Enter your desired width of the search result
That's all you need to get started! You'll now have Google Search right inside your Joomla page!
Tutorial
There is a very detailed tutorial on how to setup the googleSearch (CSE) component here: How to Create a Google Custom Search Engine in a Joomla Site
Please make sure you have set up a Custom Search Engine in your Google's account before you can use this component. Once you have created a Custom Search Engine, Google will assign a unique CSE ID to that engine. You need to enter the CSE ID into the config page to start using this component.
For advanced settings, please refer to Customizing the Component.
sh404SEF users
If you are using the googleSearch component together with sh404SEF:
- Go to sh404SEF Configuration.
- Click the "By Component" tab.
- Look for the component "googleSearch(CSE)", and set the first column as "skip".
- Don't forget to click "Save".
Please also make sure you read the following article:
"JFolder::folder: Path is not a folder: /language"
For those of you who get this error message, please refer to the article below for the solution:
Download
Very Important: Please make sure you have set up a Custom Search Engine in your Google's account before you can use this component. Once you have created a Custom Search Engine, Google will assign a unique CSE ID to that engine. You need to enter the CSE ID into the config page to start using this component.
Joomla 1.5.x: com_googleSearch_cse_v1.5.4.zip
Joomla 1.6.x: com_googleSearch_cse_v1.6.4.zip
Joomla 1.7.x: com_googleSearch_cse_v1.7.4.zip
Joomla 2.5.x: com_googleSearch_cse_v2.5.4.zip
Joomla 3.0.x: com_googlesearch_cse_v3.0.7.zip
Customizing the Component
Please refer to the googleSearch: Customizing the Component. They are about the same.
Note that for the new Google CSE, many of the options are now stored right on Google's server, e.g. the colors for the title, background, links, etc.
Note also that the Google Adsense ID and channel ID is now encoded right inside the CSE ID.
Styling the Component and Module using CSS
You can set the style of the search field and search button to the exact format you want through CSS, for example, the font family, font size, foreground and background color, margin, border, etc.
I've designed such that the css style for the component is independent of that of the module. So you can have different styles for the component and the module.
For example, if you're using the default Joomla 1.5 template, define the following style in <joomla root folder>/templates/rhuk_milkyway/css/template.css
. If you're using the default Joomla 1.0 template, define the following style in <joomla root folder>/templates/rhuk_solarflare_ii/css/template_css.css
.
- Search Box
- Search Button
- The entire search form (use this if you want to set the background or draw a border around the entire search form)
Component | Module |
---|---|
div.googleSearch_cse input.inputbox { font-family: Verdana; font-size: 12pt; font-style: italic; } |
div.mod_googleSearch_cse input.inputbox { font-family: Verdana; font-size: 12pt; font-style: italic; } |
Component | Module |
---|---|
div.googleSearch_cse input.button { font-family: "Arial Bold"; font-size: 12pt; margin-left: 4px; } |
div.mod_googleSearch_cse input.button { font-family: "Arial Bold"; font-size: 12pt; margin-top: 6px; } |
Component | Module |
---|---|
div.googleSearch_cse { background: #33FF66; } |
div.mod_googleSearch_cse { background: #33FF66; } |
Replacing the Default Search module of Joomla 1.5
Suppose you want to replace the default search module of Joomla 1.5 using the default rhuk_milkyway template, here are the steps:
- Log on as administrator and go to Module Manager.
- In the input box "Filter:", enter "search".
- You should now see two items: Search (the default mod_search), and Google Search.
- Make sure Enabled is set to No for mod_search, and Yes for Google Search.
- Assuming that you're using the default Joomla 1.5 template, define the following style in
<joomla root folder>/templates/rhuk_milkyway/css/template.css
div.mod_googleSearch table { margin-left: auto; margin-right: 6px; } div.mod_googleSearch input { width: 145px; margin: 15px 0 9px 0; }
You should now see the googleSearch module instead of the default mod_search in module position user4
.
FAQ (Frequently Asked Questions)
Q1: googleSearch_cse does not work, and I'm using sh404SEF on my website.
A1: For googleSearch_cse to work on websites using sh404SEF, please refer to the solution here.
Q2: googleSearch_cse returns the error "Google Error: Bad Request. Your client has issued an illegal request."
A2: This error usually occur when you did not enter a correct CSE ID in the config page.
Q3: I got the error message "Fatal error: Cannot redeclare class googleSearch_DisplayForm in googlesearch.lib.php on line 12"
A4: This is because you are trying to run the googleSearch_cse with an older version of googleSearch. To run both together, you need to upgrade googleSearch to v1.0.14/v1.5.14.
Q4: Can I run googleSearch_cse and googleSearch together on the same page?
A3:Yes, you can, as long as you've upgraded googleSearch to v1.0.14/v1.5.14.
Please make sure you have set up a Custom Search Engine in your Google's account before you can use this component. Once you have created a Custom Search Engine, Google will assign a unique CSE ID to that engine. You need to enter the CSE ID into the config page to start using this component.
Comments
JInstaller: :Install: File does not exist /home/admin/www/site/tmp/install_4f64f2b979ab0/com _googleSearch_cse_v2.5/googlesearchcse.php
Can you please email me the installer that you're using?
Regards,
/kksou
I had the same error. My solution is to unzip the component and change two folder names to small types:
components/com_google_SearchCSE
to componets/com_googlesearchcse
and
administrator/components/com_google_SearchCSE
to administrator/components/com_googlesearchcse
Then zip the whole Files again and upload as normal.
Hope this helps.
Regards
Hi Ryan, have just reuploaded the installer for Joomla 2.5. Please try it again and let me know if it works this time. (Note: the installer for Joomla 1.6 and 1.7 are ok)
Regards,
/kksou
The googleSearch (CSE) module is here: http://www.kksou.com/php-gtk2/Joomla-Gadgets/googleSearch-CSE-module.php#download
Regards,
/kksou
Think have seen it on the internet that you need to be Google's premium account user.
You might want to check with Google.
Regards,
/kksou
I just purchased component and received the link to download version 'com_googleSearch_cse_v1.5a'. This version is for joomla 1.5 right? I need version for 2.5.4. Please let me know. Thank you.
Regards
Sam
I want to pass search values from a basic html home page to my joomla googleSearch (CSE) component page?
is it possible and how would you suggest I go about it?
Mike
test page: http://www.KillerSurfLinks.com
Thanks Again
Sorry for the late reply.
1) Enter any search term in the search field of your joomla googleSearch (CSE) component page.
2) Click the search button.
3) In the search result page, copy the entire URL and paste them into the notepad.
4) Take a close look at the entire URL string. The search string is in the parameter q=keyword.
5) So from your basic html page, as long as you pass in the same URL string and replace q=keyword with your own keyword, it will redirect to your joomla page.
Please give it a try and let me know if it works.
Regards,
/kksou
Mike
I am working with Joomla 2.5.
I have the search box on header section. I installed the google search module and google CSE component, After enable the google module, its shows an error - "You need to install the latest version of googleSearch component to run this module! ".
Please make sure you install the right version.
1) component: from this page.
http://www.kksou.com/php-gtk2/Joomla-Gadgets/googleSearch-CSE-component.php#download
2) module: http://www.kksou.com/php-gtk2/Joomla-Gadgets/googleSearch-CSE-module.php
Please make sure you have the latest version of (1) and (2). Would suggest you uninstall both and reinstall again.
Also, please please test (1) the component first. Make sure it's working first before you install (2) the module.
Regards,
/kksou
Now the search box is displaying, but results are not displaying inside the page.
Do we need to do any changes from admin panel?
Do not leave any usename or password here. It's too risky.
Your component does not seem to work right.
As mentioned above, please uninstall both component and module again. Then install just the component. Make sure that the component is working before you install the module. The module runs on top of the component. So you have to make sure that the component is working first.
Regards,
/kksou
Please refer to reply to Scott below. It might be due to the SEF plugin that you're using (e.g. sh404SEF)
If you're using sh404SEF, please make sure you sure you turn off SEF for the component "googleSearch(CSE)". For details, please refer to: sh404SEF users: http://www.kksou.com/php-gtk2/Joomla-Gadgets/googleSearch-CSE-component.php#sh404SEF
If you're using other SEF plugins, then do something similar.
Please give it a try one more time and let me know if it works, ok?
Regards,
/kksou
I am seeing the same problem as Vino...
No results are being shown
http://www.stridedge.com/demo/bps/
Your help appreciated
Thanks
Scott
Went to your website. Think you're using some SEF such as sh404SEF.
Please refer to the following:
sh404SEF users: http://www.kksou.com/php-gtk2/Joomla-Gadgets/googleSearch-CSE-component.php#sh404SEF
If you're using sh404SEF, please make sure you sure you turn off SEF for the component "googleSearch(CSE)".
If you're using other SEF plugins, then do something similar.
Please give it a try one more time and let me know if it works, ok?
Regards,
/kksou
Yes, i am using ace sef
I think i did it but it still seems not to work. i went into extensions in ace sef and com_googlesearchcse - set it to Skip prefix / menu yes
Thanks
Scott
Just went to your website.
You can see that the url has now changed, and the googleSearch(CSE) component is displaying now.
However, if you compare your googleSearch url with the one on my website (just do any search there), you will see that the url does not seem to be too right. That's why the search result is not displaying.
You might want to play around with the setting in ace sef to see if you can make it skip the googleSearch(CSE) component entirely.
Regards,
/kksou
Also, would like to say that working fine for me on 2.5
I have a strange error though and am pretty lost.. hope you can help.
I have sh404 and htaccess on.. and your component works on the localhost. But when I uploaded it on the intranet to test, somehow the search string gets cut and it does not display any result.
For example: In localhost the url of the search string looks like this:
http://localhost/correns/index.php?
option=com_googlesearchcse&n=30&Itemid=338&cx=002319795645609495628%3Akgewgbvqfxy
&cof=FORID%3A11&ie=UTF-8&q=test6&hl=ja&cr=countryJP
http://supplier2.correns.co.jp/correns/index.php?
option=com_googlesearchcse&n=30&Itemid=338&cx=&cof=FORID%3A11&ie=&q=test&hl=
So it seems like again the language tag gets cut out. I tried your solution for Sh404, but since the content of the sh404sef.class.php has changed I coulnd't get it to work.
Really hope you can help, pls let me know if you need further information.
What do you mean by ?since the content of the sh404sef.class.php has changed??
Did you set the googleSearch component to skip in the sh404 admin backend?
Regards,
/kksou
Well so I have the latest Joomla and also sh404 component, and your tutorial is not actual any more. In sh404 you can not set it to skip, it says "treat as non sef" and there are other options, I tried them all but nothing works. Then if you go to the sh404sef.class.php and search for the method of your tutorial, it's still there, but the code below is totally different from your tutorial, so I don't know how to adjust.. That's what I meant. However, the strange thing is that it works on localhost.
Hope you can help, thx and best Regards.
For some reasons, the table of the googlecse component settings was excluded from the backup, so in new installations those were missing.
Of course it can be corrected manually, but still this is a big problem for me as I need many copies of my site.
Do you have an idea what can cause this?
Thanks..
I have a site containing articles in 5 languages.
How can we implement this component in such a case that I will have 5 different modules and each will list the results based on the language?
This is a simple component to display googleSearch result within a component - in only one language.
You might want to check joomla.org to see if there are any advanced component that can achieve what your site needs.
Regards,
/kksou
I have a problem. My site is joomla 1.5.26 and I have downloaded "Joomla 1.5.x: com_googleSearch_cse_v1.5.zip" and the module.
The module has a error "ERROR >>> You need to install the latest version of googleSearch component to run this module! "
Any help would be appreciated
I installed both CSE component and module and also make CSE on my Google account. When I try CSE for my website on the Google account it works and displays results. I added ID but I still cant get any search result on my page.
My URL is > www.tvojservis.com
Any suggestion is welcome.
Ty
Hi.
You cant use module without the component. You should install both and then try.
I'm from VietNam. My English is not good.
You can use Google Translate to do the translation to English, or you can tell me the URL so that I can take a look at the website to see what's the problem.
Regards,
/kksou
1) Goto the folder: [Joomla_Root_Folder]/administrator/components/com_googlesearchcse
2) Edit the file: admin.googlesearch.lib.php
3) Goto Line: 301. You should see
function input_site_language($row) {
4) Add your language to the array $languages = array()
Save the file. You should now see your language.
Let me know if it works, ok?
Regards,
/kksou
I'd like to make this great component to search in google and in the site as facebook, is that possible?
1) This is a Joomla component. So it can only be used in the Joomla framework, not in Facebook.
2) This component make use of the Google API. The Google API only searches pages that are indexed by google. Google API does not search those pages within Facebook.
I'm not too familiar with Facebook. Facebook might have its own API to search within its Facebook pages.
Regards,
/kksou
Great job creating this. while testing i have 2 questions.
1 - do all the options in the component, like removing the google watermark, are approved on by the google adsense policy? or is that end user responsibility?
2 - can the module be used twice with different options? i mean for example i need 2 modules where one will look differently then the other. while both show results in the component.
Thanks in advance!
Thank you very for the Google CSE tools.
I must say that I tested since two years others modules of GG CSE but no one works very well for Joomla 1.5. I had to only integrated directly from the GG code when I meet your component and on a few clics it appears on my site.
Just a little question.... as I use TA-BLANK template it is as the purity 2, the GG search results appear under the user(x) positions, is there a way to hide them so the search results page will appear completely ?
Thank you
Regards,
/kksou
You have only installed the component.
If you want the module, you also need the install the module here: googleSearch (CSE) module
Try to make sure that the component runs ok first. Once it's running, then install the module. The module will not work without the component.
Regards,
/kksou
Any suggestion?
Thanks!
Yann
Did you install both the component as well as the module?
Regards,
/kksou
plz help!
With Google's new Custom Search Engine (CSE) API, all these are now set direct in your google adsense account.
Regards,
/kksou
Not sure which part you're stuck.
Would you please elaborate a bit more?
Do you have a google adsense account? If yes, there are many tutorials in there once you're logged in that shows you how to create a search item.
Once you have created the search item with all the desired parameters, you can follow this article: Where to find CSE's unique ID?
What the googleSearch CSE component needs is this CSE unique ID. The rest of the parameters are all set in your google adsense account.
Regards,
/kksou
thank you
regards
I'm using this CSE module and component for over a year now but from some reason it stopped working few days ago. I re installed both module and component and imported the code again but it wont display the results. I tried by disabling all other components and modules one by one but it didn't help. It displays images but and ads but not actual results.
Ty in advance
Dean
Did you recently change the setting?
Try don't set the country. I tried that and it seems to work.
You can try this as testing: http://www.tvojservis.com/index.php?option=com_googlesearch_cse&n=30&Itemid=147&cx=010013177191668307214%3Al8agyyc1vve&cof=FORID%3A11&ie=UTF-8&q=Servis&sa=Pretra%C5%BEi&hl=sr&siteurl=
Regards,
/kksou
Yes, that worked.
I might have a clue why is not working when I set Serbia and Montenegro as country...
Well, "Serbia and Montenegro" as one country doesn't exist for over few years now. Nowadays those are 2 independent countries so maybe Google CSE API is don't know which one to use and it generates this bug. Maybe you should split these into 2 separate countries to choose from in the list.
Thank you for the quick response and solution.
So this component should basically search what ever is available for Google to index right?
Ty
Dean
- How to us this as part of an article? (sorry am new to Joomla :-*) .. is there a document / command. I don't want to add this to a menu.
- How to add more than one search (3 to be precise) to my site. I want users to go into appropriate search area to get relevant information. Currently it is seeding information from one CSE-ID only.
Please let me know.
Sat
I am still having issues with adjusting the width. I want the width to be dynamic and that is not happening. Currently it is all for integer value. I want to enter % value. If i want to see the site on smart phone .. it is not getting aligned and search box sticks out .. let me know how this can be achieved.
The google search API does not allow the width to be dynamic.
The entire search result is returned by google. We are not allowed to alter the returned result from google.
Also, you can do a quick google. There is a minimum width of the search result imposed by google.
Regards,
/kksou
thank you for sending the zip files!
Now - sorry for new inconvenience - I do not see the issues I have handled in your documentation...
First: I have a text in the search box that vanishes if I type - not nice. Second: I see the search result at your page integrated into an "article" and I get only a pop over window. Third: clicking a search result opens a new window instead remaining in the same one.
How did you configure it so nice? That would be the way I'd like to get it.
Did you solve the issue with the download? I tried the 2.5 Version and it did not extract too.
Thank you in advance!
Best regards
Uwe
1) Can you please elaborate on the actions you desired? When the field is empty, the default text will appear. When you start typing, whatever you type will appear, right? Naturally, the default text will disappear. If not, what actions would you want?
2) I do not control all these. It's set in your google backend. Please log on to your Google Search or Google Adsense and you have full control over there. I think you have selected a pop-up window for search result, that's why you get a pop-up window.
3) The default clicking action is by Google. Google actually do not want or allow us to change any of their search result. All search results are directly returned by Google.
Have also made some changes to the download link. Can you please try again if it works for you now?
Warm Regards,
/kksou
I am wondering if this tool can search like google (excluding some word for instance). Beside, I would like to know if it can search within the Kunena forum of my website ?
First of all: Many thanks for this great component!
One remark: Google CSE does open search result in a _blank window by default. Have you thought about adding an option to select the target?
In the file googlesearch.lib.php in the line 435 you would have to add the linkTarget like so:
RSS feed for comments to this post