Skip to content

Instantly share code, notes, and snippets.

@heukirne
Created May 3, 2013 02:19
Show Gist options
  • Save heukirne/5506796 to your computer and use it in GitHub Desktop.
Save heukirne/5506796 to your computer and use it in GitHub Desktop.
Course of Information Retrieval
<?php
$topicoStr = file_get_contents("Topicos.txt");
preg_match_all("/title\>([^\<]+)</", $topicoStr, $topicos);
$contRow = 0;
foreach ($topicos[1] as $topic) {
if (strlen(trim($topic))>0) {
$contRow++; $contDoc=0;
$code = file_get_contents("http://localhost:8983/solr/collection1/select?rows=100&fl=id,score&wt=php&rows=1&q=".urlencode(trim($topic)));
eval("\$result = " . $code . ";");
foreach ($result['response']['docs'] as $line) {
echo "$contRow\tQ0\t{$line['id']}\t$contDoc\t{$line['score']}\thenrique_manuela\n";
$contDoc++;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment