function indri_printlinks($request, $startdoc, $resultCount, $pagedocs, $prefix) { $nextlink = indri_nextlink($request, $startdoc + $pagedocs, $prefix); $prevlink = indri_nextlink($request, $startdoc - $pagedocs, $prefix); $nextfull = "<a href=\"" . $nextlink . "\">Next " . $pagedocs . "</a>"; $prevfull = "<a href=\"" . $prevlink . "\">Previous " . $pagedocs . "</a>"; $showprev = $startdoc >= $pagedocs; $shownext = $resultCount >= $pagedocs; $result = "<h4>"; if ($showprev) { $result .= $prevfull; } if ($showprev && $shownext) { $result .= '|'; } if ($shownext) { $result .= $nextfull; } $result .= "</h4>"; return $result; }
<?php echo $snippet; ?> </div> [ <a href="<?php echo $cachedlink; ?> ">Cached</a> ] </div> <?php } ?> <?php $nextlink = indri_nextlink($_REQUEST, $startdoc + 10); $prevlink = indri_nextlink($_REQUEST, $startdoc - 10); if ($startdoc >= 10) { ?> <h4><a href="<?php echo $prevlink; ?> ">Previous 10</a> | <a href="<?php echo $nextlink; ?> ">Next 10</a></h4> <?php } else { ?> <h4><a href="<?php echo $nextlink; ?>
$meta = $doc->metadata; $range = new position($results[$i]->begin, $results[$i]->end); $matches = indri_documentMatches($results[$i]->document, $annotatedResults->getAnnotations(), $nodes, $range); $snippet = indri_buildsnippet($doc->text, $matches, $doc->positions, $indri_param['snippet_length'], $range); $title = substr($snippet, 0, 50) . "..."; $title = isset($meta["docno"]) ? $meta["docno"] : $title; $title = isset($meta["path"]) ? substr($meta["path"], strrpos($meta["path"], '/') + 1, strlen($meta["path"])) : $title; $title = isset($meta["title"]) ? $meta["title"] : $title; $prefix = ""; if (isset($meta["docno"]) and isset($meta["title"])) { $prefix = $meta["docno"] . ": "; } $beginlink = isset($meta["url"]) ? "<a href=\"" . $meta["url"] . "\">" : ""; $endlink = isset($meta["url"]) ? "</a>" : ""; $cachedlink = indri_buildlink($_REQUEST, $results[$i]->document); $nextlink = indri_nextlink($_REQUEST, $startdoc + 10); ?> <div id="result"> <h2><?php echo $prefix . $beginlink . $title . $endlink; ?> </h2> <div id="snippet"> <?php echo $snippet; ?> </div> [ <a href="<?php echo $cachedlink; ?> ">Cached</a> ]