Skip to main content
Ben Nadel at CFUNITED 2010 (Landsdown, VA) with: Brian Swartzfager
Ben Nadel at CFUNITED 2010 (Landsdown, VA) with: Brian Swartzfager ( @bcswartz )

Kinky Solutions Now Utilizes Google Custom Search As Site Search

By on

I can't write site search engines. It has always been a serious Achilles Heel for me. We used to use Verity here at work, but with ColdFusion 7's Verity engine, our machines kept crashing during the seemingly endless indexing process. As such, I have resorted to caveman-like strategies involving SQL LIKE searches (I just cringed a little bit when saying that).

But, I don't want to get into that nightmare - like I need to feel any more inadequate about it. What I wanted to say was that I finally took the time to implement the Google Custom Search technology on my site (you might now notice that my search boxes are Google-branded). Setting up a Google Custom Search box was extremely simple. I started out following a setup tutorial on SEOMoz.org, but that turned out to be slightly dated. The good news is, since that tutorial was written, implementing the Google Custom Search has become even easier (it seems). Now, you don't have to fool around with creating customized result pages - you can actually host the search results directly on your sight using an IFrame.

It's pretty sweet stuff. The Site Search on my site is now finally "usable". I love me some Google.

Reader Comments

57 Comments

Cool. I've been looking at doing that as well.

Verity is such a great tool - I wish Adobe would show it some love and made it easier to use - especially the vspider...

15,674 Comments

@Jim,

I hear you. I tried to get the Verity Spider to work, but I could not for the life of me figure it out. Certainly, the whole thing seems way too complicated for my caveman brain. And, the idea that anything requires LOCALHOST to be used, that just can't be good.

15,674 Comments

@Luis,

It's pretty straight forward. Just start out with the SEO Moz tutorial. Now, in the CODE section, you can opt to host the search box AND the results, which basically just requires you to copy-n-paste two different snippets of code.

11 Comments

I never liked the Google site searches - it always looked to me that the site owner was lazy.

I read this article last night and was on the fence about implementing it so I talked with my partner this morning and he had the same feelings as I.

Plus it comes along with it's own ads, doesn't look to be styled the way you want it, you won't be able to track search hits and or misses, and it always looks - even though it's only pulling from your site - as if it's gonna pull stuff from somwhere else.

15,674 Comments

@Chewbacca,

All valid concerns. You can turn off the ads. As far as the Lazy thing, I agree and disagree. It might look lazy, but I know that it is a much better search than I could build myself. So, until my actual programming abilities are better in this matter, Google Search is clearly the better option.... at point, you have to accept defeat for the greater good.

11 Comments

I guess my search is pretty specific for my site, because I have to find establishments,
my article searches are only using fulltext searches.

What I do for establishment searches is order the queries in what is usually relevant:

* Look for the name of the establishment that people are searching for first
(which based on my search logs is near 95%) - and save the IDs from the query.

* Then I do a soundex search on what they typed on the establishment name and
street name - and save these IDs.

* Then I do a keyword search - and save these IDs as well.

* Last I make a list of all of the IDs from the queries - remove duplicates - and
display the results using:

where id in (#PreserveSingleQuotes(ListQualify(IDsList,"'"))#)

and to retain the order of relevance:

order by field(id,#PreserveSingleQuotes(ListQualify(IDsList,"'"))#) ASC

That's for MySQL you coul also use:

ORDER BY (
(
<cfloop index="XindeX" from="1" to="#listlen(IDsList)#">
CASE WHEN ID = '#listgetat( IDsList, XindeX )#'
THEN #XindeX#
ELSE 0
END
) + (
</cfloop>
CASE WHEN ID = '99999999999'
THEN 1
ELSE 0
END
)
) ASC

15,674 Comments

@Chewy,

That sounds pretty good. I think one of the problems with a lot of sites is that they are a combination of database driven pages and static pages (as with my site) and I don't know how to handle that. And, on top of that, a lot of my pages run off or SEO URLs that Verity or something else might not be able to handle (or at least not with my limited knowledge).

All to say, I think each situation requires it own tools. And, I have a lot to learn about searching including how to use SQL Server's full text indexing.

2 Comments

Ben,

This is great stuff, I already implemented it on two of my sites and my clients love it. Thanks for the tip.

57 Comments

That is one of the best things about Verity's vspider. It hits your site just like Google does - so it doesn't care if the data is dynamic or static. It's great when/if you can make it work.

The third party sites are nice - but I'd be hesitant to use it on a commercial site. Years ago I spent a lot of time setting up a search through one of these services - only to have them first change their business model and start charging, then they went belly up. Of course it's unlikely Google would do that - but you never know...

I believe in love. I believe in compassion. I believe in human rights. I believe that we can afford to give more of these gifts to the world around us because it costs us nothing to be decent and kind and understanding. And, I want you to know that when you land on this site, you are accepted for who you are, no matter how you identify, what truths you live, or whatever kind of goofy shit makes you feel alive! Rock on with your bad self!
Ben Nadel