public function GoogleMini::setDateSort in Google Search Appliance 6.2
Same name and namespace in other branches
- 5 GoogleMini.php \GoogleMini::setDateSort()
Sets sorting type (date or relevancy) and direction
Parameters
string $dir: A - Sort in Ascending order D - Sort in Descending order
string $mode: S - Return the 1,000 most relevant results, sorted by date. R - Return all results, sorted by date. *** WARNING *** Do not use this filter if your collection contains more than 50,000 documents. If the result set is very large, the sort operation could create significant delays in the display of results.
File
- ./
GoogleMini.php, line 141
Class
Code
public function setDateSort($dir = "D", $mode = 'S') {
if ($dir != 'A' && $dir != 'D') {
throw new GoogleMiniCriteriaException(sprintf("The Sort direction provided is incorrect. Got %s, needs to be A or D", htmlentities($dir)), E_WARNING);
}
if ($mode != 'S' && $mode != 'R') {
throw new GoogleMiniCriteriaException(sprintf("The Sort mode provided is incorrect. Got %s, needs to be S or R", htmlentities($mode)), E_WARNING);
}
// build sort string
// http://code.google.com/apis/searchappliance/documentation/46/xml_reference.html#request_sort_by_date
$this
->setQueryPart('sort', "date:{$dir}:{$mode}:d1");
return true;
}