Пример #1
0
// how many results to get back
$first_result_to_return = 0;
// what ranked results show be the first to be returned (0 = highest ranked)
$data = $controller->queryRequest($query, $num_results, $first_result_to_return);
outputQueryData($data);
/*
  next we do a related search (as our index only has one page in it)
  the only related page is the page itself
*/
echo "\n\n\nAn example of making a related query request with the search API\n";
$url = "http://www.ucanbuyart.com/";
$num_results = 10;
// how many results to get back
$first_result_to_return = 0;
$index_timestamp = "1317414322";
$data = $controller->relatedRequest($url, $num_results, $first_result_to_return, $index_timestamp);
outputQueryData($data);
/*
  Finally, we give an example of requesting the cached version of
  a downloaded page...
*/
echo "\n\n\nAn example of making a cached of page request" . " with the search API:\n";
$url = "http://www.ucanbuyart.com/";
$ui_flags = array();
$search_terms = "art classifieds";
// these words will be highlighted
$index_timestamp = "1317414322";
$data = $controller->cacheRequest($url, $ui_flags, $search_terms, $index_timestamp);
echo $data;
/*
  We now delete the example index to clean-up our test. In real-life