<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Search Nuggets &#187; Ajax</title>
	<atom:link href="http://blog.comperiosearch.com/blog/tag/ajax/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.comperiosearch.com</link>
	<description>A blog about Search as THE solution</description>
	<lastBuildDate>Mon, 13 Jun 2016 08:59:45 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=3.9.40</generator>
	<item>
		<title>Introducing Solrstrap: A blazing fast tool for querying Solr in a Googleish fashion</title>
		<link>http://blog.comperiosearch.com/blog/2013/02/17/introducing-solrstrap/</link>
		<comments>http://blog.comperiosearch.com/blog/2013/02/17/introducing-solrstrap/#comments</comments>
		<pubDate>Sun, 17 Feb 2013 10:21:31 +0000</pubDate>
		<dc:creator><![CDATA[Fergus McDowall]]></dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[bootstrap]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[Solr]]></category>

		<guid isPermaLink="false">http://blog.comperiosearch.com/?p=1235</guid>
		<description><![CDATA[I have just made the first (unnumbered) release of Solrstrap available on github http://fergiemcdowall.github.com/solrstrap/ Solrstrap is a Query-Result interface for Solr- it is intended to be a starting point for those building web interfaces that talk to Solr, or a very lightweight admin tool for querying Solr in a Googleish fashion. Cool things about Solrstrap: [...]]]></description>
				<content:encoded><![CDATA[<p>I have just made the first (unnumbered) release of Solrstrap available on github <a href="http://fergiemcdowall.github.com/solrstrap/">http://fergiemcdowall.github.com/solrstrap/</a></p>
<p>Solrstrap is a Query-Result interface for Solr- it is intended to be a starting point for those building web interfaces that talk to Solr, or a very lightweight admin tool for querying Solr in a Googleish fashion.</p>
<p>Cool things about Solrstrap:</p>
<ul>
<li>Requires <em>only</em> local installation- easy to set up</li>
<li>Access to all Bootstrap functionality. Can be easily extended in a Bootstrappy way.</li>
<li>Blazing fast</li>
<li>Uses less bandwidth</li>
</ul>
<p>Use it as you see fit. Merciless criticism and fawning praise equally welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.comperiosearch.com/blog/2013/02/17/introducing-solrstrap/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Make an &#8220;instant search&#8221; application using JSON, Ajax and JQuery</title>
		<link>http://blog.comperiosearch.com/blog/2012/06/27/make-an-instant-search-application-using-json-ajax-and-jquery/</link>
		<comments>http://blog.comperiosearch.com/blog/2012/06/27/make-an-instant-search-application-using-json-ajax-and-jquery/#comments</comments>
		<pubDate>Wed, 27 Jun 2012 10:41:15 +0000</pubDate>
		<dc:creator><![CDATA[Fergus McDowall]]></dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[Json]]></category>
		<category><![CDATA[OpenSearch]]></category>
		<category><![CDATA[Wikipedia]]></category>

		<guid isPermaLink="false">http://blog.comperiosearch.com/?p=975</guid>
		<description><![CDATA[Update 20th Feb 2013: Instant search is now implemented on Solrstrap, the lightweight Solr interface written in JavaScript, HTML and CSS. Check it out here. Here is a quick demo that demonstrates how to create an &#8220;instant search&#8221; service using JSON, ajax and JQuery. This instant search application uses the excellent OpenSearch interface provided by [...]]]></description>
				<content:encoded><![CDATA[<p><em><strong>Update 20th Feb 2013:</strong> Instant search is now implemented on <a href="http://blog.comperiosearch.com/blog/2013/02/17/introducing-solrstrap/" title="Introducing Solrstrap: A blazing fast tool for querying Solr in a Googleish fashion">Solrstrap</a>, the lightweight Solr interface written in JavaScript, HTML and CSS. <a href="http://blog.comperiosearch.com/blog/2013/02/17/introducing-solrstrap/" title="Introducing Solrstrap: A blazing fast tool for querying Solr in a Googleish fashion">Check it out here</a></em>.</p>
<p>Here is a quick demo that demonstrates how to create an &#8220;instant search&#8221; service using JSON, ajax and JQuery. This instant search application uses the excellent OpenSearch interface provided by Wikipedia. Use this code as a starting point for developing prettier result pages.</p>
<p>The Wikipedia query API is described in some detail <a href="http://www.mediawiki.org/wiki/API:Main_page" target="_blank">here</a>.</p>
<p><a href="http://blog.comperiosearch.com/wp-content/uploads/2012/06/instantsearch.html">Click here to see the demo</a>, or copy and paste the code below into a blank HTML document.</p><pre class="crayon-plain-tag">&lt;script type=&quot;text/javascript&quot; src=&quot;http://code.jquery.com/jquery-latest.js&quot;&gt;&lt;/script&gt;</pre><p></p>
<h1>Search Wikipedia!</h1>
<p></p><pre class="crayon-plain-tag">&lt;input id=&quot;searchterm&quot; type=&quot;text&quot; /&gt; &lt;button id=&quot;search&quot;&gt;search&lt;/button&gt;</pre><p></p>
<div id="results"></div>
<p></p><pre class="crayon-plain-tag">&lt;script type=&quot;text/javascript&quot;&gt;// &lt;![CDATA[
      $(&quot;#searchterm&quot;).keyup(function(e){
        var q = $(&quot;#searchterm&quot;).val();
        $.getJSON(&quot;http://en.wikipedia.org/w/api.php?callback=?&quot;,
        {
          srsearch: q,
          action: &quot;query&quot;,
          list: &quot;search&quot;,
          format: &quot;json&quot;
        },
        function(data) {
          $(&quot;#results&quot;).empty();
          $(&quot;#results&quot;).append(&quot;

Results for &lt;b&gt;&quot; + q + &quot;&lt;/b&gt;

&quot;);
          $.each(data.query.search, function(i,item){
            $(&quot;#results&quot;).append(&quot;
&lt;div&gt;&lt;a href='http://en.wikipedia.org/wiki/&quot; + encodeURIComponent(item.title) + &quot;'&gt;&quot; + item.title + &quot;&lt;/a&gt;&quot; + item.snippet + &quot;&lt;/div&gt;
&quot;);
          });
        });
      });

// ]]&gt;&lt;/script&gt;</pre><p></p>
<div style="position: absolute; bottom: 0; right: 0; text-align: right;"><a href="http://blog.comperiosearch.com/author/fmcdowall/">Fergus McDowall</a> 2012</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.comperiosearch.com/blog/2012/06/27/make-an-instant-search-application-using-json-ajax-and-jquery/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Asynchronous search results with JQuery, Solr, Json and Ajax</title>
		<link>http://blog.comperiosearch.com/blog/2011/03/31/asynchronous-search-results-jquery-solr-json-ajax/</link>
		<comments>http://blog.comperiosearch.com/blog/2011/03/31/asynchronous-search-results-jquery-solr-json-ajax/#comments</comments>
		<pubDate>Thu, 31 Mar 2011 13:52:40 +0000</pubDate>
		<dc:creator><![CDATA[Fergus McDowall]]></dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[User Experience]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[Json]]></category>
		<category><![CDATA[Solr]]></category>

		<guid isPermaLink="false">http://nuggets.comperiosearch.com/?p=369</guid>
		<description><![CDATA[Update: Aug 5th 2012 A live demo of asynchronous search results with JQuery, Solr, Json and Ajax can now be found here There are many reasons to load search results asynchronously- most of the big searchy dotcoms are going in this direction with Google, Facebook and Twitter all relying heavily on ajax to render their [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://blog.comperiosearch.com/wp-content/uploads/2011/03/solr.jpg"><img src="http://blog.comperiosearch.com/wp-content/uploads/2011/03/solr.jpg" alt="Solr is the popular, blazing fast open source enterprise search platform from the Apache Lucene project" title="Solr Logo" width="283" height="156" class="alignleft size-full wp-image-376" /></a></p>
<p><strong>Update: Aug 5th 2012</strong><a href="http://blog.comperiosearch.com/wp-content/uploads/2012/09/solr.html"> A live demo of asynchronous search results with JQuery, Solr, Json and Ajax can now be found here</a></p>
<p>There are many reasons to load search results asynchronously- most of the big searchy dotcoms are going in this direction with Google, Facebook and Twitter all relying heavily on <a href="http://en.wikipedia.org/wiki/Ajax_%28programming%29">ajax</a> to render their feed-based pages.</p>
<p>Considering how mainstream it has become, information on the nuts and bolts of the technique remain thin on the ground. So here is a really quick overview of what you need to get started.</p>
<p>For the purposes of this post I will assume that you have an working installation of <a href="http://lucene.apache.org/solr/">Solr</a> in a more or less standard configuration. Getting Solr up and running is no mean feat in itself, but mercifully there are a number of fairly decent guides squirreled away on the internet. You could of course use any search motor that returns search results in a Json format, in fact even if they dont, <a href="http://www.comperiosearch.com/products/comperio-front/">Comperio Front</a> can now be used to provide a <a href="http://www.json.org/">JSON</a> query service on any (collection of) search motor(s).</p>
<p>So lets assume that a query for &#8220;Ford&#8221; returns Json in the following format from our very small index of cars. Note that the Solr URL for this feed would look something like this: http://localhost:8080/solr/select/?q=ford&amp;wt=json&amp;json.wrf=?&amp;indent=true where wt specifies json and json.wrf specifies the <a href="http://stackoverflow.com/questions/483073/getting-a-better-understanding-of-callback-functions-in-javascript">callback</a></p><pre class="crayon-plain-tag">({
  &quot;responseHeader&quot;:{
    &quot;status&quot;:0,
    &quot;QTime&quot;:1,
    &quot;params&quot;:{
      &quot;json.wrf&quot;:&quot;?&quot;,
      &quot;indent&quot;:&quot;true&quot;,
      &quot;q&quot;:&quot;ford&quot;,
      &quot;wt&quot;:&quot;json&quot;}},
  &quot;response&quot;:{&quot;numFound&quot;:3,&quot;start&quot;:0,&quot;docs&quot;:[
      {
        &quot;id&quot;:&quot;147&quot;,
        &quot;name&quot;:&quot;Ford Capri&quot;,
        &quot;description&quot;:&quot;pink 1978 model- great condition&quot;,
        &quot;owner&quot;:&quot;576463865&quot;,
        &quot;store&quot;:&quot;59.7440738,10.204456400000026&quot;,
        &quot;tags&quot;:[
          &quot;Ford, Capri, Pink, 1978&quot;]},
      {
        &quot;id&quot;:&quot;148&quot;,
        &quot;name&quot;:&quot;Ford Orion&quot;,
        &quot;description&quot;:&quot;Blue, Good runner&quot;,
        &quot;owner&quot;:&quot;576463865&quot;,
        &quot;store&quot;:&quot;59.9138688,10.752245399999993&quot;,
        &quot;tags&quot;:[
          &quot;blue, orion, 1.6&quot;]},
      {
        &quot;id&quot;:&quot;149&quot;,
        &quot;name&quot;:&quot;Ford Anglia&quot;,
        &quot;description&quot;:&quot;As seen in Harry Potter, Can be flown&quot;,
        &quot;owner&quot;:&quot;576463865&quot;,
        &quot;store&quot;:&quot;57.2366283,-2.2650615999999673&quot;,
        &quot;tags&quot;:[
          &quot;Harry Potter, Anglia, Flying car&quot;]}
    ]
  }
})</pre><p></p>
<p>We can now parse this feed by using the .getJSON function in the excellent jQuery library. The javascript and associated HTML would be more or less like so:</p><pre class="crayon-plain-tag">&lt;div id=&quot;rs&quot;&gt;&lt;/div&gt;
  &lt;script type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js'&gt;&lt;/script&gt;
  &lt;script type='text/javascript'&gt;
    $.getJSON(&quot;http://localhost:8080/solr/select/?q=ford&amp;wt=json&amp;json.wrf=?&amp;indent=true&quot;, function(result){
    var Parent = document.getElementById('rs');
    for (var i = 0; i &lt; result.response.docs.length; i++) {
      var thisResult = &quot;&lt;b&gt;&quot; + result.response.docs[i].name + &quot;&lt;/b&gt;&lt;br&gt;&quot; + result.response.docs[i].description
      + &quot;, &quot; + result.response.docs[i].tags + &quot;&lt;br&gt;&quot;;
      var NewDiv = document.createElement(&quot;DIV&quot;);
      NewDiv.innerHTML = thisResult;
      Parent.appendChild(NewDiv);
    }
  });
&lt;/script&gt;</pre><p>And thats it :-) You will notice that when the HTML above is loaded in a browser, that the search results are returned independently of the webpage.</p>
<p><strong>Next Steps:</strong> <a href="http://blog.comperiosearch.com/2012/09/using-handlebars-js-to-display-results-from-solr-a-primer/" title="Using Handlebars.js To Display Results From Solr- A Primer">Use JavaScript templating to render results from Solr</a></p>
<a href="http://blog.comperiosearch.com/wp-content/uploads/2011/03/solr.jpg"><img src="http://blog.comperiosearch.com/wp-content/uploads/2011/03/solr.jpg" alt="Solr is the popular, blazing fast open source enterprise search platform from the Apache Lucene project" title="Solr Logo" width="283" height="156" class="size-full wp-image-376" /></a>
]]></content:encoded>
			<wfw:commentRss>http://blog.comperiosearch.com/blog/2011/03/31/asynchronous-search-results-jquery-solr-json-ajax/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
