Sort by option is not showing in my google custom search

8 views
Skip to first unread message

satheesh kumar

unread,
May 14, 2015, 5:25:03 AM5/14/15
to custom-sea...@googlegroups.com
Hi,

 I have integrated the google custom search option in my website. i am using following code for custom search option,

<!DOCTYPE html>
<html>
<head>
<title>Results Only Layout Demo</title>
<script>
 
(function() {
   
var cx = 'my search engine id';
   
var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true;
    gcse
.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
       
'//www.google.com/cse/cse.js?cx=' + cx;
   
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s);
 
})();
</script>
</head>


<body>
<div id="cse" style="width: 100%;">Loading</div>
 
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">  
  google
.setOnLoadCallback(function() {
   
var customSearchControl = new google.search.CustomSearchControl('my search engine id');
   
var options = new google.search.DrawOptions();
    options
.enableSearchResultsOnly();
    customSearchControl
.draw('cse', options);
      customSearchControl
.execute("Search Text");
 
}, true);
 
</script>
</body>


</html>


When i use the above code, it is not showing the sort by option. I have enabled the code in my account.  if i am using <gcse:searchbox-only  resultsUrl="newpage.php"></gcse:searchbox-only>  code, it shows the sort by option well. So please help us to show the sort option

Reply all
Reply to author
Forward
0 new messages