Hi everyone, after some time tinkering with PHP and Solr I finally am able to output the data I need using the following PHP script:
$core_url = "http://localhost:8983/solr/[corename]/select?q=";
$start=$page*10-10;
$contents = file_get_contents($core_url.'Keywords:'.$query.'&wt=php&rows=10&start='.$start.'&fl=Journal_title,Publisher,Keywords,Journal_URL,Full_text_formats,Full_text_language,Most_Recent_Article_Added,Number_of_Article_Records'.'');
eval("\$result = " . $contents . ";");
$count = $result["response"]["numFound"];
$numOfPages = ceil($count/10);
if($count==0){
echo "no results found";
}
for($i=0; $i<sizeof($result["response"]["docs"]) ; $i++){
echo '<div class="searchresult">';
foreach($result["response"]["docs"][$i] as $key=>$value){
display($key,$value);
}
echo '</div>';
echo "<br/>";
}
function display($k,$x){
if(!isset($x)){
return;
}
echo $k.": ";
if(!is_array($x)){
echo $x;
echo "<br>";
}
else {
for($i=0; $i<sizeof($x) ; $i++){
if(sizeof($x)==1 || $i==sizeof($x)-1){
echo $x[$i];
}
else {
echo $x[$i].' - ';
}
}
echo "<br>";
}
}
?>
This gives me the following result on the search page:
[had to remove image, only allowed to upload one, but in short, it just shows all data in an unorganized manner.]
Now my question is, how do I properly display this information on the search page like so:
I truly hope that anyone can help me with this, in case you can send me to a tutorial on how to do so that would be great as well. In case I did not provide enough information, please let me know and I will elaborate on it.
Thanks in advance,
Joris