Exemple #1
0
// 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
  you wouldn't want to delete your query index after making one query
*/
unlinkRecursive(CRAWL_DIR . "/cache/Archive1317414322");
unlinkRecursive(CRAWL_DIR . "/cache/IndexData1317414322");
// demo over, bye-bye for now!
exit;
/**
 * Short function to pretty-print the data gotten back from a Yioop! query
 * @param array $data  what we got back from doing a query
 */
function outputQueryData($data)
{