浏览代码

fixed issue with random titles and abstracts not returning 10 items

main
Simon Bowie 2 年前
父节点
当前提交
7a4bedb650
共有 1 个文件被更改,包括 8 次插入3 次删除
  1. +8
    -3
      site/solr.php

+ 8
- 3
site/solr.php 查看文件

@@ -162,13 +162,15 @@ function one_random_record ($core){

function ten_random_titles ($core){

for ($x=0; $x <= 9; $x++) {
$x = 0;
while ($x <= 9) {
$random = get_random_record($core);

foreach($random as $id => $content){
// Search for the title in the content element and display it
if (preg_match('/Title.*\n(.*)\n/', $content, $title)){
$output[$x] = array($id=>$title[1]);
++$x;
}
}
}
@@ -177,16 +179,19 @@ function ten_random_titles ($core){

function ten_random_abstracts ($core){

for ($x=0; $x <= 9; $x++) {
$x = 0;
while ($x <= 9) {
$random = get_random_record($core);

foreach($random as $id => $content){
// Search for the abstract in the content element and display it
if (preg_match('/Abstract.*\n(.*)\n/', $content, $abstract)){
$output[$x] = array($id=>$abstract[1]);
++$x;
}
elseif (preg_match('/\(.\) \\n\\n(.*)\\n/', $content, $abstract)) {
$output[$x] = array($id=>$abstract[1]);
++$x;
}
}
}
@@ -196,7 +201,7 @@ function ten_random_abstracts ($core){
function ten_random_doc_refs ($core){

$x = 0;
while ($x < 9) {
while ($x <= 9) {
$random = get_random_record($core);

foreach($random as $id => $content){

正在加载...
取消
保存