Search Logger
Posts from: Mark Lucovsky, Software Engineer

Author Archive

New Feature: Site Restricted Search

7:49 pm - June 7, 2006 in Google AJAX Search API Blog

We launched the Google AJAX Search API as a Version 0.1 API so that we could take a little bit of time to gather feedback from you. We welcome feedback on the current API as well as suggest features that we could add that would make your lives easier.

One suggestion that we have heard from many of you concerns site restricted searching. You wanted to be able to implement a "Search my site", "Search the web" quickly, easily, and with professional results and styling.

This afternoon, we updated the service to include a handful of new methods, documentation, and samples that should get you pointed in the right direction.

For all searchers, you now have the ability to set a user defined label for a specific searcher. This lets you replace the current system defined label of "Web", "Blog", etc., with a label of your choice e.g., "My Site", "Amazon.com", etc. Since you might want to provide unique styling for this searcher, we also added a new method that allows you to specify a user defined class suffix to wrap the results for any searcher. This is a pretty advanced feature, but for those of you that have a knack for CSS, you will appreciate the cool new things this allows you to do. And yes, our new sample application uses this...

Finally, for site restrictions, the GwebSearch and GblogSearch classes now support a .setSiteRestriction() method that forces search results to be scoped based on the programmed restriction. Our sample application demonstrates the use of this by configuring a web searcher to only return results from Amazon, and by configuring a blog searcher to only return posts from the Live Journal Nintendo DS blog. Check out a sample.

 

A New Gadget

7:17 pm - June 8, 2006 in Google AJAX Search API Blog
Yesterday we launched a new gadget for the Google Personalized Homepage that is based on the Google AJAX Search API. Why embed a search gadget on a search homepage, you may ask? Well, it can actually be pretty useful. I have mine configured for just GlocalSearch() scoped to my home town. I use it as a very fast, in-page phone book. (You can add the new gadget directly to your Google homepage.)

In other news, you all asked for a way to clear search results and there are a few samples out there that work hard to do this. We tried to make it a bit easier with a new .clearAllResults() method. Just call this method on your search control whenever you need to clear out old results. We didn't want to clutter the UI with a new button that does this, but if a user clears out the input element and then hits return or clicks the search button, we call this method internally.

And finally, the guys that produced the assorted blue artwork gave me a matching set in green, dark grey, pink, and orange. If you want your search control to use pink artwork, just include gsearch_pink.css, right after you include gsearch.css. The point of this wasn't to promote alternate colors. It was more about demonstrating how to style the search control to fit better in your application. Take a look at Sitesearch.html for an example of the gsearch_green.css. You can also try gsearch_pink.css, gsearch_orange.css, or gsearch_darkgrey.css.
 

New Feature: .setLinkTarget()

8:06 pm - July 5, 2006 in Google AJAX Search API Blog
We launched the Google AJAX Search API as a Version 0.1 so that we could take a little bit of time to gather feedback from developers. We've been reading the developer forum and taking note of your feedback on the current API, as well as suggestions that would make integrating it into your applications easier and more seamless.

One feature that several people have requested is the ability to control link targets in the search results, since links were being uniformly created with target="_blank". We just updated our servers to support new functions that control the value of the target attribute in generated links. The search control object now supports a .setLinkTarget method which accepts
  • GSearch.LINK_TARGET_BLANK - open links in a new window
  • GSearch.LINK_TARGET_SELF - open links in the current frame
  • GSearch.LINK_TARGET_TOP - open links in the top most frame
  • GSearch.LINK_TARGET_PARENT - open links in the parent or top most frame
  • frame-name - open links in the specified frame
To create a search control and program it to open links in the current frame, use the following code sequence:
    var sc = new GSearchControl(); sc.setLinkTarget(GSearch.LINK_TARGET_SELF);
For those of you using raw searcher objects, independent of the search control, the .setLinkTarget() method is available on searchers as well:
    var searcher = new GwebSearch(); searcher.setLinkTarget(GSearch.LINK_TARGET_BLANK);
The default value for link targets is GSearch.LINK_TARGET_BLANK that will cause links to open in a new window. Thank you for your feedback, suggestions, and ideas. Please keep them coming.
 

Fix for Key Validation Issue

9:53 pm - July 20, 2006 in Google AJAX Search API Blog
Given the recent activity on the message board, here's an update on some of the key validation problems that affected people earlier in the week. There were two distinct, but somewhat related issues at hand, both of which have been resolved.

First, people received errors because "GSearchControl" was undefined. This was due to a number of things, such as invalid API keys, API key sharing across different URLs, and typos in the script tag that loaded the API. Previously, these errors would fail silently, but we made a change to respond with a 200 instead of a 400 and also deliver an alert() call with a string indicating that either your key was invalid, that the version you specified was invalid, that the resource (file=uds.js) was invalid, etc.

Second, we made a mistake with the key validator and didn't allow for reasonable alternatives of the hostname (e.g., http://www.example.com vs. http://example.com). We've since fixed this issue.

Our mistake was in taking a silent error and turning it into a noisy one, and I apologize for the painful process that many of you experienced. Your ability to react in real time to the changes helped us monitor and fix this in real-time, so we appreciate all the helpful feedback.
 

New Features, New Sample

6:48 pm - July 31, 2006 in Google AJAX Search API Blog
We made some changes over the last several days, relating mostly to GlocalSearch, but also impacting GblogSearch.

Previously, GlocalSearch commingled address resolution results with local search results, providing things like "New York, NY 10038" alongside "New York Pretzel" and "New York Cafe." There's now a method for indicating whether you want those address resolution results included. You can set this yourself or expose it to users with the local search configuration UI.
    .setAddressLookupMode(GlocalSearch.ADDRESS_LOOKUP_DISABLED) - disables commingled results

    .setAddressLookupMode(GlocalSearch.ADDRESS_LOOKUP_ENABLED) - enables commingled results, the default
We also adjusted the search behavior when an address clause is present in the query string. For example, a search for "starbucks" will produce search results near the center point associated with the searcher, while a search for "starbucks 93108" or "starbucks in cary, nc" will now produce results near the location in the query string.

There's a new Local Search sample to demonstrate some new concepts and techniques and serve as a simple starting point for location centric apps. If you're running a conference, hotel, community site, etc., this might make a nice little addition to your page.

As suggested in the discussion group, we implemented the ability to sort GblogSearch results by date. This is available for programmatic access as well as through the UI.
    .setResultOrder(GSearch.ORDER_BY_RELEVANCE) - This is the default and indicates that results should be returned in order of their relevance.

    .setResultOrder(GSearch.ORDER_BY_DATE) - This value indicates that results should be returned should be returned in publication date order.
Let us know if you experience any problems as a result of these recent changes, and keep the suggestions coming.
 

Add Map Search to your site

12:37 pm - August 8, 2006 in Google AJAX Search API Blog
This week I am speaking on Search APIs at the Search Engine Strategies Conference. Unfortunately, by the time I got around to reading the Hotel and Venue page, I discovered that all the recommended hotels are sold out.

When I look at that page, all I see is text (and of course a sidebar of logos for the sponsors). Where is the map? Why can't I just just search for a nearby hotel directly from this page, or search for nearby restaurants? This happens to me every time I go to a conference, like a few weeks ago when I ended up on the other side of the river from OSCON's conference center.

I called my friends over at O'Reilly and asked them if they would mind if I worked with their site a little. The result is a Mapsearch Solution that uses the Google AJAX Search API and Google Maps API. I'm calling it a "solution" because it's a piece of code that you can use as-is, or copy and enhance to suit your needs. Take a look at the mapsearch sample to see how easy it is to add something like this to your site. If you are already using these APIs, you already have a key and know how to include the code. Once you've done that:
  1. Include the new gsmapsearch.js and gsmapsearch.css solution files
  2. Create and style a div element, one for each control
  3. Add a call to GSmapSearchControl(element, address, options?), one for each control. Something like:
      var container = document.getElementById("mapSearchDiv"); new GSmapSearchControl(container, "1236 Lisa Lane, Los Altos CA");
If you are running a conference web site, or a hotel web site, or any sort of travel or community web site, this could be a great feature to add without much effort. And it's something your visitors will appreciate.
 

A couple UI changes

10:41 pm - August 17, 2006 in Google AJAX Search API Blog
One thing that's been on our list for a while now is changing the current UI for switching between one search result, more search results, and all search results.

The new treatment use three buttons that let you quickly select one, more, or all search results. Each button has "tool tip" style text that shows up on hover to help everyone learn the meaning of the buttons (note the tool tips are in English, but are in the localization queue).

We're still a v0.1 API and very much a work in progress. So these buttons may change again -- let us know what you think.

Another change you may have noticed is the little "x" next to the default search button that gives users a way to quickly clear results. Hopefully this will make things easier for those who have been writing custom UIs for clearing results.

Like most pieces of the API, you can use CSS if you'd prefer that these buttons not appear in your search control:
    /* turn on the new results selector buttons */
    #mySearchControl .gsc-results-selector { display : none; }

    /* turn off the new clear results button */
    #mySearchControl .gsc-clear-button { display : none; }
On a related note, I'd strongly recommend learning how to develop on Firefox and make use of DOM Inspector. With it you can "inspect" any page, and then "inspect" a node (like a button or piece of text). DOM Inspector will allow you to see where the element sits in the page's DOM Tree, what CSS rules apply to the element, the computed style for the element, etc.
 

Add video search, playback, and tagging to your site

2:45 pm - August 29, 2006 in Google AJAX Search API Blog
Last week my son asked me if I could show him how to add some videos to his music review blog. Instead of just putting one video on the blog, I decided that it would be sort of fun to have 100+ videos directly accessible from any blog or web page.

The result of this effort is a Video Search solution. Like the Mapsearch solution, this is something you can use as-is or copy and enhance to suit your needs.

We tried to make this easy to use on any web page or blog. If you are already using the Google AJAX Search API, you have an API key and know how to include the code. Once you have done that:
  1. Include the gsvideosearch.js and gsvideosearch.css solution files
  2. Create and style a div element
  3. Create a list of tagged searches you want your readers to see by default
  4. Add a call to GSvideoSearchControl and point it at the div created in step 2
You can see a live version of this solution on the Google Video Blog (under "Fun Videos").

Take a look at the Video Search solution and let us know what you think, especially if you have any plans to include this on your site.
 
 
 
 
 
 
It's All About Search | © clsc.net |
2012.05.1822:35
Tech used here: Valid HTML - Valid CSS - Valid RSS - JavaScript - PHP - Smarty - MySQL - and a partridge in a pear tree.