Feb 4 2010

CSBE API">Google Custom Search Refinements and the CSBE API

As part of my duties at Site­Point, I’m imple­ment­ing a Google Cus­tom Search Engine (Busi­ness Edition).

One of the neat fea­tures of Google’s CSE is Refine­ments. You can tag por­tions of your site — sub­di­rec­to­ries, sub­do­mains, or even sep­a­rate sites that you’ve added to your engine — with labels. You can then cre­ate refine­ments that will either boost results from these tagged regions of your site, list only results from spec­i­fied tags, or exclude cer­tain tags alto­gether from the result set.

Unfor­tu­nately the means of using these pro­gram­mat­i­cally are not so well doc­u­mented — the API doc­u­men­ta­tion doesn’t spec­ify how to include or exclude cer­tain labels (as far as I’ve been able to determine).

So! For the record, the solu­tion is to use the strings ‘more:<label>’ and ‘less:<label>’ in your query string.

Con­tinue reading