Tag Archives: cse

Firefox Extension: Search Everywhere

Have you ever been at a web site and wanted to find something on it but couldn’t because the site either lacked search functionality or had a useless one? Did you want a tool to help in your predicament? Here’s one that I’ve found helpful: Search Everywhere by Paul Komarek. It was developed by a colleague of mine, and as a search junky, I got to be one of the beta testers. It’s now officially on the Firefox Add-ons page.

The extension was designed “to search the outgoing links from any webpage”. A use case for that is if you’re on a particular site and wanted to learn more about a particular topic, you would use this extension to search the keyword on Google and it would look up the keyword through the site and other sites the current site linked to, on the premise that the current site would link to relevant/related resources.

When I started using this, there was no way to specifically search for results in the current site, so I requested it and Paul implemented it in the latest version. This one little addition has made the feature much more useful to me. I could have manually done a [site:domain keyword] query but that would have taken more effort.

Of course, the extension can only provide results as long as Google has indexed the site. Also, a heads-up that it might take a few seconds to get results when doing a search involving linked sites… probably due to the Custom Search Engine having to go fetch and process the linked sites. A SiteSearch is as quick as any Google Search so that would seem to confirm that theory.

Linked Custom Search Engines

When I first learned of Linked Custom Search Engines from Google Co-op, I didn’t really get it. When I got the explanation, I then saw the potential.

Previously, to create a custom search engine, we needed to go into a control panel to give Google a list of sites we want it to show results from. Depending on the topic or purpose of the CSE, this didn’t scale.

With linked CSE, we only need to give Google a page that contains links to sites that we want to show results from. Google then generates a custom search engine with those sites as sources. This is great for themed sites that link to related sites. It helps the user find additional information from other sites that the current site has linked to. For example, a linked CSE at a Mac website will tend to show results from sites that are related to all things Mac.

For my blog, I wanted to create a CSE that would encompass all the sites that I have linked to, either in posts or blog roll. Since I try to link to quality sites, I tend to get good quality, related results. I called my cse, Thu’s Blogosphere. It shows results from my blog and from all the links on my page that lists all posts. As I add links in my posts, the CSE will automatically get new links to add to my CSE. Google was also smart to cache the data so that my cse doesn’t take forever to load up each time due to the hundreds of links I have.

Having a page that lists all blog posts helps increase the coverage of links, as can be seen in the resulting xml file that Google generates on the fly based on the inputted page. The xml file from my blog home page alone doesn’t contain as many urls.

To conceptualize the difference that this makes compared to regular web search, a search for [cat] in my blogosphere will show results about four-legged feline pets. A regular search for [cat] also includes results about the Cats musical, and the company, Caterpillar.

The links page to feed to Google doesn’t need to be like the one I’m using. It was just easier for me to build a page with all of my blog links by showing all my posts. It would be more efficient to show a page that contains only links. I just couldn’t figure out how to do that.

Google AJAX Search Results in WordPress

Not even a day had passed since I figured out How to Integrate Google Custom Search Engine Results into WordPress Blog Template and I figured another way to integrate search results into WordPress.

As described at the site, “Google AJAX Search API lets you put Google Search in your web pages with JavaScript.”

One of the drawbacks to the earlier method was that the results were in an iframe, so it was less integrated in the look of the site. Another thing I wanted was to be able to switch from searching my blog to more general search.

The second method using Ajax allows for customizing css of the search results, and it has tab functionality to show different types of results.

Someone had already implemented Ajax Search in Blogger. I used the provided template to come up with a slimmed-down version of the code to put into my WordPress blog.

At first, I was going to put the search results in a separate page. But I didn’t know how to do the search form for it, so I did what the ajax blogger did and put it right on the page where the search is executed. You can view the source if you want the search code. I put the search form in a widget in the sidebar.

I wrote the code so that the “More results” link goes to my template but it’s not working for some reason. I saw in an example where it worked, though. It’s a new feature so hopefully it’s just a temporary issue. Update: It turned out it was because I didn’t include the hl parameter, which was required. Oops.

Another thing I wanted to do was take advantage of the new feature, “Linked Custom Search Engines” to show results that were not only from my blog, but from sites I link to. This would have greater focus than a general web search, and would show results from related sites when mine doesn’t have the results. However, the results aren’t what I had expected so I need to do some more research to refine the custom search engine.

Update: I won’t be dropping the other search page because it comes in handy as a template for search results. I can use the Ajax search for results on the page, but for additional results, I have to fall back on the non-Ajax search.

Update: After investing a lot of time to ensure that this worked throughout my blog, I found that there is an Ajax search plugin. I installed it to see if it would meet my needs. It’s definitely convenient to have a plugin, but it doesn’t support CSE, for example. However, for someone who doesn’t already have this functionality, the plugin is a great option.

How to Integrate Google Custom Search Engine Results into WordPress Blog Template

I was checking out the control panel for my blog’s Google Custom Search Engine and saw something under the Code tab that I hadn’t noticed before: Search box and search results code for your website

I was intrigued at the thought of having the search results show up with my blog’s theme. After completing my search page, I thought I’d share how to do it.

First, create a new page in the theme’s folder called _search.php and upload it with the following content:
Continue reading

How to Use Google Custom Search Engine with WordPress Blog

I had trouble finding a good source of information on how to set up Google Custom Search Engine to replace the built-in search function of my WordPress blog, so I’ll share some tips I eventually learned.

Custom Search Engine

First, you will need to create a custom search engine that shows results for your blog. Then try out your CSE.

If you see that rss feeds are showing up and want to get rid of them, edit the cse Sites category:

  1. Under Excluded Sites, click on Add Sites.
  2. Enter the url of the feeds: yoursite.com/blog/?feed=rss2*
  3. Select the option: Exclude all pages whose address contains this URL
  4. Save

Search Box

Now that you have your own search engine for your blog, you’ll want to be able to use the search box to search it. In the CSE’s Control Panel, go to the Code category. Select the style you want. Then copy the code that gets outputted. Open up the blog theme’s sidebar.php file (make a backup copy). Look for the search box code and paste over it with the CSE code. You might need to play around with it to make it look nice for your blog.

Note that using CSE limits searches to what Google has indexed of the blog.