<rdf:Description rdf:about="http://snarfed.org/space/site%20search%20with%20the%20Google%20AJAX%20Search%20API">
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Ryan Barrett &lt;snarfed at ryanb dot org&gt; </dc:creator>
  <dc:date> 2006-11-10T22:22:00Z </dc:date>
  <dc:language> en </dc:language>
  <dc:format> text/html </dc:format>
  <dc:rights> Copyright 2002-2009 Ryan Barrett </dc:rights>

  <content>
    <table><tr><td>
<img src="/space/ajax.jpg">
</td><td style="vertical-align: center">
<a href="http://code.google.com/"><img src="/space/google_code.png" /></a>
</td></tr></table>

<p><em>Updated 2007-12-21.</em></p>

<p><a href="/ajax_search.js">ajax_search.js</a> uses the
<a href="http://code.google.com/apis/ajaxsearch/signup.html">Google AJAX Search API</a>
to do site search. It's similar to Google's
<a href="http://services.google.com/searchcode2.html?accept=on#both">existing site search</a>,
except that it shows the results within <em>your</em> site, not Google's. It also
degrades gracefully, by falling back to standard Google site search over HTTP
for users who don't have JavaScript.</p>

<p>You can <a href="/ajax_search.js">check out the JavaScript</a>, or
<a href="#" onclick="new site_search('snarfed.org', 'ajax'); return false;">
 try it out</a>
right now! But heads up, your browser's back button won't work. Blame AJAX.</p>

<p>To use this on your site, first
<a href="http://code.google.com/apis/ajaxsearch/signup.html">apply for an AJAX Search API key</a>.
Then, place <a href="/ajax_search.js">ajax_search.js</a> on your server and the
following HTML on your page:</p>

<div class='p-shadow'><pre><code>&lt;form class="form" method="get" action="http://www.google.com/search"
  onsubmit="new site_search('[YOUR_DOMAIN]', q.value); return false;"&gt;
  &lt;input type="hidden" name="sitesearch" value="[YOUR_DOMAIN]" /&gt;
  &lt;input type="text" name="q" id="query" value="Search" /&gt;
&lt;/form&gt;

&lt;script type="text/javascript"
   src="http://www.google.com/uds/api?file=uds.js&amp;v=1.0&amp;key=[YOUR_KEY]"&gt;
&lt;/script&gt;
&lt;script type="text/javascript" src="[PATH]/ajax_search.js"&gt;&lt;/script&gt;
</code></pre></div>

<p><br class='clearing' />Replace <code>[YOUR_KEY]</code>, <code>[YOUR_DOMAIN]</code>, and <code>[PATH]</code> with your AJAX Search API
key, your site's domain, and the path to <code>ajax_search.js</code> on your server,
respectively.</p>

<p>Finally, set the <code>results_div_id</code> variable in <code>ajax_search.js</code> to the id of an
div where you want search results to be placed. This div will be deleted and
recreated when a search is performed. You can also customize <code>results_header</code>,
<code>results_footer</code>, and <code>searching_message</code>, if you want.</p>

<p>The search results are placed in divs with distinct classes, so you can style
them with CSS. Here are the classes:</p>

<div class='p-shadow'><pre><code>gsc-title
gsc-back

gs-result
 |- gs-title
 |- gs-snippet
 |- gs-visibleUrl
 |- gs-watermark

gsc-branding
 |- gsc-branding-text
 |- gsc-branding-img-noclear
</code></pre></div>

<p><br class='clearing' />The <a href="http://www.google.com/uds/css/gsearch.css">AJAX Search API stylesheet</a>
has more details. As an example, this is the CSS used on this site. It's
similar to the <a href="http://google.com/">google.com</a> style.</p>

<div class='p-shadow'><pre><code>div.gs-result        { margin-top: 1em; }
div.gs-title         { text-decoration: underline; }
div.gs-visibleUrl    { color: green; }
div.gs-watermark     { display: none; }
div.gsc-back         { float: right; }
table.gsc-branding   { border: none; }
td.gsc-branding-text { color: gray; }
</code></pre></div>

<p><br class='clearing' />Happy AJAX searching!</p>

<p><a href="/ajax_search.js">ajax_search.js</a> is copyright 2006 <a href="/space/about">Ryan
Barrett</a>, and is distributed under the
<a href="http://www.gnu.org/licenses/gpl.html">GPL</a>.</p>

<p>See also:</p>

<ul>
<li><a href="/space/pyblosxom ajax comments">pyblosxom ajax comments</a></li>
<li><a href="/space/software">software</a></li>
<li><a href="/space/ideas">ideas</a></li>
<li><a href="/space/2006-08-23">migrating to pyblosxom</a></li>
</ul>

  </content>

  <rdf:Seq>

<rdf:li>
<rdf:Description rdf:about="#1160789978.0">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> christopher baus </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Cool.&nbsp; Got it to work on my site.&nbsp; Could use some CSS love though.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1161085241.39">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Isaac </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    The link doesn't seem to work for me, neither on Firefox nor on IE. It only displays a "Searching..." comment. I guess the website has some deep secrets that I should not find!
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1161196837.42">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Matt </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Mine just says 'searching...' too, not sure what I am doing wrong.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1161209429.33">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Ryan </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    hmm, odd. if you're using firefox, could you pull up Tools=&gt;Javascript Console, click Clear, then try searching again and see if it shows an error message?
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1161371582.07">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Matt (again) </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Hi Ryan. First of all, thanks for posting this code on your site, so helpful.&nbsp; But, it is working in firefox but not in IE.&nbsp; It says 'the results are...' then no results appear.&nbsp; It also has an error on the page.&nbsp; When I look at the details it points to line 58 of the javacript which says this 'for (i = 0; i &lt; results.length; i&nbsp; ) '.&nbsp; This is right before the 'ugly brittle hack'.&nbsp; I am just using, in the html, a div tag of &lt;div id="results"&gt;&lt;/div&gt; where I renamed the id in the javascript.&nbsp; I don't understand why it is not working, Any ideas?&nbsp; Thanks again.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1161377411.2">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Ryan </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    argh, sorry for the trouble, matt.<br />
<br />
IE is most likely getting confused because your div's id and the <code>results</code> variable have the same name. try renaming your div to something else, like <code>"search-results"</code>, and change the <code>results_div_id</code> at the top of <code>ajax_search.js</code> to match.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1161381523.48">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Matt </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    That worked!&nbsp; I don't know why I didn't realize what I had done.&nbsp; Thanks again for the help, your code is awesome!!
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1163014622.82">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Larry </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Ryan, this is a very cool and helpful tutorial. I have one 'issue' w/ putting it on my site. Below each result it says "clipped from Google - 11/2006" Anyway to get rid of that?
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1163015722.99">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Larry again </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Also, is there any way to hide the URL below the result summary so there's just a link above?
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1163023484.3">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Ryan </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    sure! you can hide individual parts of the search results with <a href="http://w3schools.com/css/">CSS</a>. there's example CSS near the end of this article, and you can tools like Firefox's <a href="http://kb.mozillazine.org/DOM_Inspector">DOM Inspector</a>, as well as Google's <a href="http://www.google.com/uds/css/gsearch.css">Ajax Search CSS</a>, to dive deeper.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1163191487.06">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Bob </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Instead of using a div tag to place the results, is there a way to put it in a table?&nbsp; Thanks alot.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1163193471.56">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Ryan </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    if you're ok with putting all of the search results in a single <code>td</code> cell, you could just put a <code>div</code> inside that cell. however, if you want each result in its own row in the table, you'll need to write javascript to convert each <code>div class="gs-result"</code> into a <code>tr</code>.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1163195883.35">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Bob </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    I know you can put a div in a td tag but it doesn't seem to work when I do it with this.&nbsp; I don't know javascript well enough, so I'll keep trying.&nbsp; Thanks for the help.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1167699979.19">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Aaron </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Nice code,&nbsp; seems to be working alright for me, good work!
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1167860193.83">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Jim Van Abbema </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Hi Ryan, I'm impressed with the features in your code (particularly that results can be displayed within one's site).&nbsp; My primary question is How can I place the form in my top frame and target a page with the div in it in the bottom frame?&nbsp; I've attempted to change the .setLinkTarget in the ajax_search.js to "main" (the name of my bottom frame) or even to "blank," but it will not respond.&nbsp; Can you offer some pointers on what I should specify in the form or the js file?&nbsp; <br />
&nbsp; I have a test page that I've been experimenting with (http://nhmag.com/top-test.html) where I've placed the form in the position I would like it to be (the top of this page is to become a top frame) with the div lower on the same page, and I am getting some strange results.<br />
&nbsp; 1.&nbsp; Only a small portion of the documents containing any given work are displayed.&nbsp; Entering "conservation," for example, displays only 4 results.&nbsp; Is there a limit setting on this?<br />
&nbsp; 2.&nbsp; The name of a given page is shown (it is an active link to the page), and below the text sample are two full repeated URLs , one which is plain text, the other appears to be a link but does not function.&nbsp; Can these be removed or hidden?<br />
&nbsp; 3.&nbsp; And, like Larry above, I would also like to get rid of that "clipped from Google" link.&nbsp; But the CSS link you gave goes only to a general CSS tutorial.&nbsp; Is there a more specific link that shows how to hide parts of the search results?&nbsp; <br />
&nbsp; Thanks for any advice you can offer.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1168287319.04">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> ryan </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    hi jim! thanks for the kind words.<br />
<br />
i don't believe javascript in one frame can target the DOM in another frame. they're two entirely separate DOMs. i'm no expert, though, so a recent reference on DHTML/javascript/DOM might prove me wrong.<br />
<br />
1. you can get up to 8 results for a search, but <a href="http://groups-beta.google.com/group/Google-AJAX-Search-API/browse_thread/thread/4079d6f2a9534b4/9dbd8aa83e0ecb74?lnk=gst&amp;q=number results&amp;rnum=6#9dbd8aa83e0ecb74">no more</a>. this is a built-in limit, probably to prevent screen scraping. whether you actually get 8 results for a given search depends on what's in google's index.<br />
<br />
2 and 3. sure! you can do both of these with CSS. to hide the URLs, use:<br />
<pre>div.gs-visibleUrl { display: none; }<br />
div.gs-visibleUrl-long { display: none; }</pre><br />
to hide the "clipped from Google" image, use:<br />
<pre>div.gs-watermark { display: none; }</pre><br />
...but if you do, you'll be violating the <a href="http://code.google.com/apis/ajaxsearch/terms.html">terms of service</a>! see section 2.3, Attribution.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1168563445.92">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Todd </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    I'd like to add the search box to the header of every page, but only have one page that shows the results of the search. Is there a way to do this? Excellent job BTW!
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1168641025.55">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> ryan </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    you mean, you'd like search results to appear in a new HTML page, retrieved with a standard HTTP GET or POST instead of an AJAX request?<br />
<br />
sure, you could make the search box form submit to your search results page, and put an onLoad() in that page to trigger the actual AJAX search request. that's clunky, though. :/
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1172568432.48">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> BIll </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Does the script work on an Intranet?
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1172598968.68">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Ryan </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    sorry, no, it doesn't. it only searches google's public index of the web. you might be able to get it to work with the <a href="http://www.google.com/enterprise/gsa/#utm_medium=et&amp;utm_source=bizsols&amp;utm_campaign=gsa">google search appliance</a>, though.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1173774265.43">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Glococo </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Hello, I want to search on a mysql table when I m typing on a form<br />
What script does that ?<br />
<br />
Thankyou, verymuch !
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1177292480.42">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Ajax is Google Code the Power </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Ajax is Google Code the Power
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1183025271.93">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> stupid me </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    one question does this search sites that has not been indexed by google? or this will supposedly search the entire web?
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1183048788.21">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> ryan </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    this only searches sites that have been indexed by google. if your site isn't in google's index, or if it's an intranet, this won't work for you.<br />
<br />
google does have <a href="http://www.google.com/enterprise/enterprise_search.html">intranet search solutions</a>. they're physical machines, though, and they cost money.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1187647473.98">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> DrStein </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Hi there<br />
<br />
I loved the code, I was searching for a way to use the google search without making users leave my website.<br />
<br />
Anyway, I think for usability is best to actually include de "Search" button, is there any way you can tell me how to do that?<br />
<br />
Thanks a lot.<br />
<br />
<br />
Felipe
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1187648244.08">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> ryan </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    sure! just add a submit button to the form, e.g.<br />
<code> &lt;input type="submit" value="Search" /> </code&gt;
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1188585391.1">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> DrStein </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Hi again<br />
<br />
I'm a little confused with something, I think I did everything right but I keep getting "no results" everytime I search, I thought It was because I indexed the site on google almost at the same time but time passes by and still no results. Do you know if this is because of a badly implemented code or I just have to wait?<br />
<br />
Anyway, here goes my javascript code... sorry for the trouble<br />
<br />
<br />
&lt;div class="search"&gt;<br />
 &lt;form class="form" method="get" action="http://www.google.com/search"<br />
&nbsp; onsubmit="new site_search('http://www.revistaasiatica.cl/', q.value); return false;"&gt;<br />
&nbsp; &lt;input type="hidden" name="sitesearch" value="http://www.revistaasiatica.cl/" /&gt;<br />
&nbsp; &lt;input type="text" name="q" id="query" value="" /&gt;<br />
&nbsp; &lt;input type="submit" value="Buscar" /&gt;<br />
&lt;/form&gt;<br />
<br />
&lt;script type="text/javascript"<br />
&nbsp; src="http://www.google.com/uds/api?file=uds.js&amp;v=1.0&amp;key=keygoeshere"&gt;<br />
&lt;/script&gt;<br />
&lt;script type="text/javascript" src="../../permanent/ajax_search.js"&gt;&lt;/script&gt;<br />
<br />
Didn't know if it was necessary but I removed the key from the code<br />
<br />
Thanks<br />
<br />
<br />
Felipe
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1188588713.27">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> ryan </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    hi felipe! try using just your domain, "revistaasiatica.cl", without the "http://www.", as the site_search() parameter and sitesearch input value.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1188926172.17">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Andrea </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Hey,<br />
first of all thanks for this great script.<br />
I have some trouble though when I search a second time without reloading the page. It automatically switches to google.com and doesn't stay on my site...<br />
Another problem is that it shows only a few results compared to the results that appear at googles original site. Is this on purpose&nbsp; and is there any way to fix these two issues?<br />
<br />
And then, may I spread the results over more than one site? So that I only show about 4 results and to see the next four, the user has to click on a "next"-button that loads them dynamically into the divs... How could this work?<br />
<br />
I appreciate your help,<br />
thanks in advance,<br />
Andrea
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1189524795.4">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> DrStein </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Me Again XD<br />
<br />
This has less to do with the coding, because as far as I can tell it's working great (and I have to thank you for that really).<br />
<br />
Do you know how long it takes for google to update their err... database I guess, so it can show new results, because I put the search code in a test page first to see how it worked, but now everything is OK and it keeps giving me results like www.revistaasiatica.cl/test/x.html.<br />
<br />
I'm guessing it's just a matter of time before it's updated, but since you got the search box here, I thought I'd ask how long it takes.<br />
<br />
Thanks again, you've been great.<br />
<br />
<br />
Felipe
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1192075497.52">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Dr.Dre </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    I must say you are blog is the best, brother. I searched Google up and down can't not find a simple example let alone tutorial. Then, I found your blog and I became the happiest programmer in the world. YAHOOOOOOOOOOOOOOO for snarfed.org.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1192235315.03">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Dr. Dre </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Hi, it's me again. I am having problem with this search. It does return result but I can't seem to position the result where I want it to appear. Your search result appears clean and neat within that box. I went through your site but can't figure it out. Please, help.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1193310521.0">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Carl </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    <i>"sure, you could make the search box form submit to your search results page, and put an onLoad() in that page to trigger the actual AJAX search request. that's clunky, though."</i><br />
<br />
I really need this, but do not know how to implement it. Can you <b>(Ryan)</b> or some else please post the codes.<br />
<br />
Thanks
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1195551841.56">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> SimonRaven </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    hey,<br />
<br />
firebug and the JS console keep complaining about GwebSearch not being defined. I can't find that function in either uds.js or ajax_search.js at all. I get the same results as&nbsp; "Andrea, Tue 04 Sep 2007": page goes to google.com after I hit enter in the search box (I defined the needed ID, etc.) WTH is this function? :)
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1195551990.79">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> SimonRaven </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Oh, and folks might want to s/&amp;/&amp;amp/; that URI, or to ; , otherwise the XML checker in some browsers will puke.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1195581020.03">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> ryan </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    The <a href="http://code.google.com/apis/ajaxsearch/documentation/reference.html#_class_GwebSearch">GwebSearch</a> class is part of Google AJAX Search's public API. It's used in <a href="http://snarfed.org/ajax_search.js">ajax_search.js</a> on line 36 to do the search. It's defined in one of the other script files that <code>uds.js</code> pulls in.<br />
<br />
I took a look at the <code>uds.js</code> script tag on <a href="http://simonraven.kisikew.org/home/">http://simonraven.kisikew.org/home/</a>, and it looks like you have a couple <code> &amp;amp; </code> sequences in the URL that shouldn't be escaped. Try converting them to plain <code>&</code> characters.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1198255744.91">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Jane </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Ryan, this is brilliant - thanks! I've got it working really nicely.<br />
<br />
One question, though: I notice that Google have now increased the results returned to 32, with a pagination feature. How can I add that to your script?<br />
<br />
Thanks
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1198263076.68">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> ryan </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    thanks for the ping! i've updated the script to pull in results from all of the pages.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1198275763.79">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Jane </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Many thanks for a fantastically quick response, Ryan. Unfortunately, when I replace the old script with this version, I get an error: Line 32, character 13, Expected identifier. Do I need to modify my page as well?<br />
<br />
Thanks
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1198281105.22">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> ryan </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    hmm. it should be a drop-in replacement, so no, you shouldn't have to modify your HTML.<br />
<br />
this site is currently using the new script, and it works for me in firefox 2. where do you see the error? which browser are you using?
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1198281637.25">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> ryan </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    never mind, i see it in IE 6. ok, debugging...
...fixed. whee, gotta love browser interoperability testing. thanks for catching that!
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1198319637.96">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Jane </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Ryan,<br />
<br />
Many thanks, that's fine now - on IE 7 as well.<br />
Merry Christmas!<br />
<br />
Jane
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1199197228.12">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Dan </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Hi, i am very new to Ajax and am unsure what to do. i have followed instructions and all i get when i type into the input box and search is the google website.<br />
<br />
<a href="http://www.gameslayer.co.uk/search/index.html">http://www.gameslayer.co.uk/search/index.html</a><br />
and the javascript is ajax_search.js.<br />
<br />
Thanks in advance for any help.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1199222484.33">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> ryan </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    hi dan! it looks like you have the same problem as simonraven, above. try changing the <code>&amp;amp;</code> sequences in your <code>script</code> tag's <code>src</code> attribute to plain <code>&amp;</code> characters.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1199223532.84">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Dan </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    thanks for your quick reply, tried that and i still get the same problems, do you know if there could be another problem?
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1199225995.85">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> ryan </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    ah, you need a div for the results to go in. try adding <code>&lt;div name="page-content" /&gt;</code>.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1199228471.81">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Dan </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    i added the div, i think in the right place, not working still, not sure if i added the div correctly though.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1199233386.08">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> ryan </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    sorry, my mistake. the div snippet should be <nobr><code>&lt;div id="page-content" /&gt;</code></nobr>. you also need to close the <code>&lt;script&gt;</code> tag just before it with <code>&lt;/script&gt;</code>.<br />
<br />
i made a <a href="/space/gameslayer_search.html">local copy</a> with those changes, and it seems to work.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1199234630.35">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Dan </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    thanks for all your help, that works now.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1201978747.46">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Pat </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Thanks for this app, I have been looking for something like this for a long time.<br />
My question is how I can keep it from switching to google results page instead of my site page. I don't see where I made a mistake in the coding. Can you help?
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1202147062.86">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Travis </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Hi Ryan,<br />
<br />
Great script! I've had no problems getting it to work.<br />
<br />
Do you intend to add pagination through result sets? <br />
<br />
i.e. <a href="http://www.google.com/uds/samples/apidocs/raw-searchers.html">http://www.google.com/uds/samples/apidocs/raw-searchers.html</a><br />
<br />
I gave a go at this, but I don't have much of an understanding of JavaScript/AJAX.<br />
<br />
Thanks!
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1208501055.42">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Stephen </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Ryan,<br />
<br />
&nbsp; I am a beginner to write the scripts. <br />
Here is the code, I modified from your source code.<br />
<br />
&lt;form class="form" method="get" action="http://www.google.com/search"<br />
&nbsp; onsubmit="new site_search('http://www.myname.com', q.value); return false;"&gt;<br />
&nbsp; &lt;input type="hidden" name="sitesearch" value="http://www.myname.com" /&gt;<br />
&nbsp; &lt;input type="text" name="q" id="query" value="" /&gt;<br />
&nbsp; &lt;input type="submit" value="search" /&gt;<br />
&lt;/form&gt;<br />
<br />
&lt;script type="text/javascript"<br />
&nbsp; src="http://www.google.com/uds/api?file=uds.js&amp;amp;v=1.0&amp;amp;key=mykey"&gt;<br />
&lt;/script&gt;<br />
&lt;script type="text/javascript" src="ajax_search.js"&gt;&lt;/script&gt;<br />
<br />
After I enter something to search, it will jump out to google and show the following message:<br />
<br />
Your search - test - did not match any documents. <br />
<br />
Suggestions:<br />
Make sure all words are spelled correctly.<br />
Try different keywords.<br />
Try more general keywords.<br />
Try fewer keywords.<br />
<br />
Please help me to find the issue.<br />
<br />
Thanks,<br />
<br />
Stephen
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1226496458.33">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Ahmad </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Hello Ryan, many many thanks for the script......<br />
<br />
may i know how to implement paging like (pages : 1,2,3,4) if I need not all the results in the same page, I want 10 or 20 records per page...<br />
<br />
thanks,<br />
<br />
Ahmad.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1231751326.64">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Web Design Horsham </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Hi thankyou for the quick script! Could you tell me if there are any ways to show 100 results on my page?<br />
<br />
Thanks<br />
<br />
Charlie
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1232163221.94">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> rufus </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    cool, this is a helpful little page.<br />
Can you tell me, is it possible to exclude certain pages from the results? or limit the search to one directory within the domain?
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1238121705.01">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> just_me </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    I am here with Carl; I love the idea of ajax, but I really need the results to open in a new page, designed specially for the "Search Results" . I am a good designer, but terrible coder, and I love buy a brew for a person who could explain how to get the search query to a new page, that would then trigger the ajax form to display results in the div. anyone ?<br />
<br />
I would paypal you money for a sixpack!<br />
<br />
thanks.
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1252693614.22">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Maulik </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    I have joined the ajax search party, 'twas painless!
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1253708362.17">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Jim </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Thanks m8!<br />
Works fine!
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1264181578.86">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Web Design Horsham </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    It's been a year since I last used this.. Thanks again!
  </content>
</rdf:Description>
</rdf:li>

<rdf:li>
<rdf:Description rdf:about="#1267775147.88">
  <dc:source> http://snarfed.org/ </dc:source>
  <dc:title> site search with the Google AJAX Search API </dc:title>
  <dc:creator> Loki </dc:creator>
  <dc:date> cmt_pubDate </dc:date>
  <dc:format> text/html </dc:format>

  <content>
    Thanks so much for this!<br />
It was working well for us, for about a month and now seems to be broken.<br />
Have there been any changes?
  </content>
</rdf:Description>
</rdf:li>

  </rdf:Seq>
</rdf:Description>
</rdf:RDF>
