Introduction
burrp! local ajax search widget is a Javascript API which allows you to include burrp's local search on your website/blog. This API powers your webpage with the burrp! local widget to perform AJAX searches on one of the burrp local sites. You can request an API license by sending us an email on widgets@burrp.com.

To see the widget in action, check out these sites - http://www.burrp.com/widget/ and http://burrpwidgets.blogspot.com/
API Examples
These are some of the starting examples for the usage of the API in your webpages.
Hello World!
Try this
Here's the most basic usage of this API, which will create a search form on your page and allow your users to search burrp! local while being on your site.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 <head>
  <script type="text/javascript" src="http://mumbai.burrp.com/search/api/72684lclf8eluvu4"></script>
  <script language="javascript">
   function clientFunction(){
    var myLocalSearch = new BurrpLocalSearchWidget();
    myLocalSearch.paint();
   }
   BurrpListingSearchLoader.addToOnLoadEvent(clientFunction);
  </script>
 </head>
 <body>
  <div id="BurrpLocalSearchForm"></div>
  <div id="BurrpLocalSearchResults"></div>
 </body>
</html>
Search Form
Try this
The search laid out on your page using this API is called BurrpLocalSearchForm. The API gives you a host of options to configure the search forms that are laid out using this API. You can choose from two basic form types - referral form and static inline form. In both the cases, you have the option of choosing from two custom forms - quick search and finder.
Get familiar with the query paramters
//Query parameters for BurrpLocalSearchForm
searchParams:{
 q: "",
 n: "",
 fR: 0,
 s: "",
 sd: "",
 fPT:Array(),
 fCT:Array(),
 p: 0,
 tagsOnly:false,
 numberOfResultsPerPage
//search query
//locality for search
//rating
//sort parameter
//sort direction
//place types
//cuisine types
//page of result
//search only for tags
//number of desired results per page
String
String
Integer
String
String
Array
Array
Integer
Boolean
Integer
}

q Search query parameter entered by the user.
n Locality entered by the user. This field is binded to a burrp! neighbourhood suggest feature.
s is the sort paramter. Values P-Price, OR-Overall Rating, R-Number of Reviews.
sd is the direction of the sort. Values a-ascending or d-descending.
fPT place types specified in the search query.
fCT cuisine types specified in the search query.
p current page of the search results.
tagsOnly set to true if searching only by by tags is desired.
numberOfResultsPerPage set this to configure the number of search results being displayed on your page.

Multiple selection of fCT and fPT can be enabled using setAllowMultipleSelect.
All these search parameters can be initialized to a deault using the setSearchParams method of your instance
Pick a default form
You can choose from two different form types - static inline form (default) or Referral form. You can either choose to show the search form and the results on the same page, or on separate pages.

If you want to show the form and the results on the same page (static inline form), please see example below.
//Static inline form
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 <head>
  <script type="text/javascript" src="http://mumbai.burrp.com/search/api/72684lclf8eluvu4"></script>
  <script language="javascript">
   function clientFunction(){
    var myLocalSearch = new BurrpLocalSearchWidget();
    myLocalSearch.setExecuteDefaultSearchWithUriParams(true);
    myLocalSearch.paint();
   }
   BurrpListingSearchLoader.addToOnLoadEvent(clientFunction);
  </script>
 </head>
 <body>
  <div id="BurrpLocalSearchForm"></div>
  <div id="BurrpLocalSearchResults"></div>
 </body>
</html>

If you want to show the form and the results on two separates pages (Referral form), then please see the example below
//Referral form
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 <head>
  <script type="text/javascript" src="http://mumbai.burrp.com/search/api/72684lclf8eluvu4"></script>
  <script language="javascript">
   function clientFunction(){
    var myLocalSearch = new BurrpLocalSearchWidget();
    myLocalSearch.setCreateWidgetReferrer(true);
    myLocalSearch.setWidgetReferrerUrl("http://www.burrp.com/widget/search-results.html");
    myLocalSearch.paint();
   }
   BurrpListingSearchLoader.addToOnLoadEvent(clientFunction);
  </script>
 </head>
 <body>
  <div id="BurrpLocalSearchForm"></div>
 </body>
</html>
Note: The required methods and parameters are emphasised in the examples below. For details: setCreateWidgetReferrer, setWidgetReferrerUrl, setExecuteDefaultSearchWithUriParams
Choose a default form layout
You can choose from two different form layouts to be laid out default - Quick search or Finder. The API defaults to the former if not specified.
Finder is basically an adavaced search form which allows your visitors to create very advanced queries. Each query using this form layout can have four search parameters - place type(s)[fPT], cuisine type(s)[fCT], rating [fR] and location(s)[n]
Examples: The API defaults to Quick search. Usage to set Finder as the default form is given below.
//Setting a default Finder form
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 <head>
  <script type="text/javascript" src="http://mumbai.burrp.com/search/api/72684lclf8eluvu4"></script>
  <script language="javascript">
   function clientFunction(){
    var myLocalSearch = new BurrpLocalSearchWidget();
    myLocalSearch.setDefaultSearchForm("f");  /* set to q for Quick search*/
    myLocalSearch.paint();
   }
   BurrpListingSearchLoader.addToOnLoadEvent(clientFunction);
  </script>
 </head>
 <body>
  <div id="BurrpLocalSearchForm"></div>
  <div id="BurrpLocalSearchResults"></div>
 </body>
</html>
You can choose to execute a default query for your users with pre-filled search query parameters. You will need to use the public methods setExecuteDefaultQuery and setSearchParams available with your instance.
Example:
//Executing a query by deault
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 <head>
  <script type="text/javascript" src="http://mumbai.burrp.com/search/api/72684lclf8eluvu4"></script>
  <script language="javascript">
   function clientFunction(){
    var myLocalSearch = new BurrpLocalSearchWidget();
    myLocalSearch.setExecuteDefaultQuery(true);
    /* executes a default query with the query "chinese" in "andheri" */
    myLocalSearch.setSearchParams({q:"chinese",n:"andheri"});
    myLocalSearch.paint();
   }
   BurrpListingSearchLoader.addToOnLoadEvent(clientFunction);
  </script>
 </head>
 <body>
  <div id="BurrpLocalSearchForm"></div>
  <div id="BurrpLocalSearchResults"></div>
 </body>
</html>
Number of search results
You can set the number of search results to be displayed on your page by calling the public method setNumberOfResultsPerPage. This parameter takes an Integer as a parameter and has to be less than a server decided value for the license. Normally, the upper limit is 10.
Example:
//Number of search results to be displayed
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 <head>
  <script type="text/javascript" src="http://mumbai.burrp.com/search/api/72684lclf8eluvu4"></script>
  <script language="javascript">
   function clientFunction(){
    var myLocalSearch = new BurrpLocalSearchWidget();
    myLocalSearch.setNumberOfResultsPerPage(5);
    myLocalSearch.paint();
   }
   BurrpListingSearchLoader.addToOnLoadEvent(clientFunction);
  </script>
 </head>
 <body>
  <div id="BurrpLocalSearchForm"></div>
  <div id="BurrpLocalSearchResults"></div>
 </body>
</html>
Advanced controls  
The burrp! search widget API gives you a lot of advanced controls as an owner of this widget. Some of these controls require are implicit from your installation instruction of the widget itself, whereas others have to be specified in the usage.
URL controls
The widget could accept value from the URL if you choose to expose your widget to the URL. As a really advanced user, you would just choose to install your widget with this capability using setExecuteDefaultSearchWithUriParams with a true value and manipulate the search parameters from the URL.

//Enable URL controls
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 <head>
  <script type="text/javascript" src="http://mumbai.burrp.com/search/api/72684lclf8eluvu4"></script>
  <script language="javascript">
   function clientFunction(){
    var myLocalSearch = new BurrpLocalSearchWidget();
    myLocalSearch.setExecuteDefaultSearchWithUriParams(true);
    myLocalSearch.paint();
   }
   BurrpListingSearchLoader.addToOnLoadEvent(clientFunction);
  </script>
 </head>
 <body>
  <div id="BurrpLocalSearchForm"></div>
  <div id="BurrpLocalSearchResults"></div>
 </body>
</html>
Usage - http://www.burrp.com/widget/?BurrpSearchWidget=1&q=chinese&n=andheri&numberOfResultsPerPage=1
What all can be controlled?
All the search query parameters, number of search results to be displayed and the default search form to be displayed
searchParams   /* All the search parameters */
dSF            /* Default search form ("f" for Finder OR "q" for Quick Search) */
Usage - http://www.burrp.com/widget/?BurrpSearchWidget=1&n=andheri&dSF=q
API Class Reference
The burrp! local search API is broadly divided into three distinct namespaces - BurrpListingSearchLoader, BurrpLocalSearchWidget and logger.

BurrpListingSearchLoader is a public static class and the methods/members could be accessed using a dot [.] operator, instanciating the class is not required. All the control parameters and primary data needed to lay down the UI.

BurrpLocalSearchWidget is a public class. An instance of this class in required to access the properties and methods attached to this class. This is the class, which mostly deals with user customizations and data interchanges.