function printResult($entry, $primary, $annotations, $nodes, $indri_param) { $doc = $entry[1]; $meta = $doc->metadata; $result = $entry[2]; $range = new position($result->begin, $result->end); $matches = indri_documentMatches($result->document, $annotations, $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["url"]) ? $meta["url"] : $title; $title = isset($meta["title"]) && strlen($meta["title"]) > 0 ? $meta["title"] : $title; $title = preg_replace("/^http:\\/\\//", "", $title); $prefix = ""; $beginlink = isset($meta["url"]) ? "<a href=\"" . $meta["url"] . "\">" : ""; $endlink = isset($meta["url"]) ? "</a>" : ""; $cachedlink = indri_buildlink($_REQUEST, $result->document); if ($primary === true) { ?> <div id="result"> <div id="resulttitle"> <?php echo $prefix . $beginlink . $title . $endlink; ?> </div> <div id="snippet"> <?php echo $snippet; ?> </div> <span id="url"> <?php echo preg_replace("/^http:\\/\\//", "", $meta["url"]); ?> </span> <span id="cachedlink"> <a href="<?php echo $cachedlink; ?> ">Cached</a> </span> <!-- [ Score = <?php echo number_format(exp($result->score), 7); ?> ] --> <?php if ($this->count > 1) { $end = strlen($this->base[0]) - strlen(strrchr($this->base[0], "/")) + 1; if ($end > 7) { $base_prefix = substr($this->base[0], 0, $end); } else { // don't reduce to http:// $base_prefix = $this->base[0]; } $clean_base = preg_replace("/^http:\\/\\//", "", $base_prefix); ?> - <span id="morelink"> <a href="query.php?query=<?php echo indri_escapeurl($_REQUEST['query']); ?> &prefix=<?php echo indri_escapeurl($base_prefix); ?> ">More from <?php echo $clean_base; ?> ...</a> </span> <?php } ?> </div> <?php } else { $end = strlen($this->base[0]) - strlen(strrchr($this->base[0], "/")) + 1; if ($end > 7) { $base_prefix = substr($this->base[0], 0, $end); } else { // don't reduce to http:// $base_prefix = $this->base[0]; } $clean_base = preg_replace("/^http:\\/\\//", "", $base_prefix); ?> <div id="indentedresult"> <div id="indresulttitle"> <?php echo $prefix . $beginlink . $title . $endlink; ?> </div> <div id="snippet"> <?php echo $snippet; ?> </div> <span id="url"> <?php echo preg_replace("/^http:\\/\\//", "", $meta["url"]); ?> </span> <span id="cachedlink"> <a href="<?php echo $cachedlink; ?> ">Cached</a> </span> <!-- [ Score = <?php echo number_format(exp($result->score), 7); ?> ] --> - <span id="morelink"> <a href="query.php?query=<?php echo indri_escapeurl($_REQUEST['query']); ?> &prefix=<?php echo indri_escapeurl($base_prefix); ?> ">More from <?php echo $clean_base; ?> ...</a> </span> </div> <?php } }
function indri_nextlink($request, $startdoc, $prefix) { $server = ""; $index = ""; if (isset($request['query']) && $request['query'] != "None") { $query = "&query=" . $request['query']; } $url = "query.php?startdoc=" . $startdoc . $query; if ($prefix != "") { $url .= "&prefix=" . $prefix; } return indri_escapeurl($url); }
function indri_nextlink($request, $startdoc) { $server = ""; $index = ""; if (isset($request['query']) && $request['query'] != "None") { $query = "&query=" . $request['query']; } return indri_escapeurl("query.php?startdoc=" . $startdoc . $query); }