aym / google-ajax-apis

Automatically exported from code.google.com/p/google-ajax-apis
0 stars 0 forks source link

Websearch sort by date and twitSearch.setRestriction(extendedArgs, {'scoring':'d'}); does not work #450

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
<?php

  if (isset($_GET['dashboard']))
        $dashboard = $_GET['dashboard'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Hello World - Google AJAX Search API Sample</title>
 <link rel="STYLESHEET" type="text/css" href="/css/ikcro.css">

    <style type="text/css">
//body {
      background-color: white;
      color: black;
      font-family: Arial, sans-serif;
      font-size : 13px;
      margin: 15px;
      }
    #searchControl .gsc-control { width : 100%; }

    </style>
    <script src="http://www.google.com/jsapi" 
type="text/javascript"></script>
    <script type="text/javascript">
    //<![CDATA[

    google.load('search', '1.0', {"language" : "nl"});

    function OnLoad() {
      // Create a search control
    options = new google.search.SearcherOptions();
    options.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN);
    options.setRoot(document.getElementById("somewhere_else"));
    var searchControl = new google.search.SearchControl();
    var extendedArgs = google.search.Search.RESTRICT_EXTENDED_ARGS;
    searchControl.setResultSetSize (google.search.Search.LARGE_RESULTSET);

    var twitSearch = new google.search.WebSearch();
    twitSearch.setUserDefinedLabel("Twitter");
    twitSearch.setUserDefinedClassSuffix("siteSearch");
    twitSearch.setSiteRestriction("twitter.com");
    twitSearch.setRestriction(extendedArgs, {'scoring':'d'});
    searchControl.addSearcher(twitSearch, options);

      // tell the searcher to draw itself and tell it where to attach
      searchControl.draw(document.getElementById("searchcontrol"));

      // execute an inital search
      searchControl.execute("<?=$dashboard?>");
    }

    google.setOnLoadCallback(OnLoad, true);

    //]]>
    </script>
  </head>
  <body>
    <!--<div id="searchcontrol"></div>-->
   <div id="somewhere_else" style="width: 100%;">Loading...</div>

  </body>
</html>

What is the expected output? What do you see instead?
The result is ordered by relevance and 
twitSearch.setRestriction(extendedArgs, {'scoring':'d'});
should order it by date.
It does not?

What version of the product are you using? On what operating system?
Linux

Please provide any additional information below.

Original issue reported on code.google.com by nbaa...@gmail.com on 5 May 2010 at 6:17