SnTT: Put Google Site Search Results in the Content pane of BlogSphere
As you are probably aware of, I've been revamping keithstric.com. In that revamp I wanted to add a Google Custom Search (CSE) engine to search only my site. Making the CSE was easy enough with the wizard Google supplies but, I didn't like the way that it either redirected you to a google page or you had to submit the search to another dedicated page on your site. So I set on the quest of getting the results to show up where the content of my website usually shows up. Below I list all the things I tried and then what finally succeeded.
First I tried the default of showing the results on a google hosted page. I just didn't like that at all, I could customize it a little bit but not really.
Next, I tried having the results show up in an article type document, however, the url that gets appended to the search results page starts with "?", seems Domino didn't like this at all and kept dying with an error 500. I tried all sorts of ways to prevent the "?" from being the start of the appended URL to no avail. I did some research on what the subject and it seems when a url contains a "?" Domino expects a domino url extension (i.e. OpenDocument, OpenView or whatever) to come right after the question mark, if it's not what Domino expects, it throws an error 500. To get around it you can create a rewrite rule, but with this blog being hosted by Prominic, I really didn't want to go this route. So, this didn't work...
The last option for displaying the results from a Google Custom Search engine is to display the results as an element. This actually worked with no changes really needing to be made as far as just displaying the results. However, the results just pushed the rest of the blogs content down below the search results. While this worked, I didn't really like it, I think only the search results should show up. But I really liked that the results were "wrapped" within my website. So, how to make it so that when someone performs a search the div which contains the website content is hidden and only the search results are shown? Well, I messed with this for quite a while and never could get it to "really" work. I could hide the div which contained the content but not when the "Search" button was clicked. So I had to post a question over on the Google Custom Search Implementation Forum. The guy that answered didn't leave his actual name, only "omr" is his username and is who really got this to work and who deserves the credit for it.
Now we just need to put this within BlogSphere and we're ready to go. So without further rambling...
- First, setup your CSE to only search your site. When you do this if you go through all the options in the wizard you should find your "CSE ID" which is a long number which basically identifies your CSE.
- Once you get your CSE ID we're ready to put everything in BlogSphere.
In the BlogSphere configuration, navigate to "Blog Setup\Blog Configuration" and open up your configuration document in edit mode. On the left hand side, choose "Page Header" and paste the following code in the "custom HTML" field:
NOTE: In the "Init" function, change "YOUR CSE-ID" to be your CSE ID
Save and close your configuration document. Now, navigate to "Look and Feel\Page Templates" and open up your current page template into edit mode. In the "Beta Start" field, you should have something like:
Search keithstric.com
Top 10
These are the articles, downloads and blog posts people seem to land on most put here for your convenience
- SnTT:Flash Charts in Lotus Notes
- Running a Web Server behind a Linksys DSL Router
- Setup Courier IMAP with XMail to use Squirrelmail
- First day with T-Mobile myTouch (aka HTC Magic)
- First attempt at a Background Image
- Lotus Domino 8.0 on SuSE Linux 11
- Xmail, IMAP, POP & Webmail
- ExcelData Class
- Using the Google Charts class to put Charts in a Lotus Notes application
- Using lsxldap.dll for Directory Lookups
Archives
OpenNTF
Disclaimer
The opinions and ideas posted on keithstric.com are not necessarily the opinions and ideas of my employer. The solutions, techniques and code provided here are not guaranteed or warranted in any way and are free for you to use at your own risk.










