| 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.
|
|
//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
//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>
//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>
setCreateWidgetReferrer, setWidgetReferrerUrl, setExecuteDefaultSearchWithUriParams
q] and "where"[n]. The "where" field is binded to a burrp! Suuggest feature which will show the locality suggestions when a user types in the locality input box.
fPT], cuisine type(s)[fCT], rating [fR] and location(s)[n]
//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>
setExecuteDefaultQuery and setSearchParams available with your instance.
//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>
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.
//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.
|
|
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
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
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.