summaryrefslogtreecommitdiff
path: root/inc/fulltext.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/fulltext.php')
-rw-r--r--inc/fulltext.php19
1 files changed, 3 insertions, 16 deletions
diff --git a/inc/fulltext.php b/inc/fulltext.php
index 0411b9f99..35ee4ba34 100644
--- a/inc/fulltext.php
+++ b/inc/fulltext.php
@@ -124,26 +124,13 @@ function _ft_pageSearch(&$data) {
/**
* Returns the backlinks for a given page
*
- * Does a quick lookup with the fulltext index, then
- * evaluates the instructions of the found pages
+ * Uses the metadata index.
*/
function ft_backlinks($id){
$result = array();
- // quick lookup of the pagename
- // FIXME use metadata key lookup
- $page = noNS($id);
- $matches = idx_lookup(idx_tokenizer($page)); // pagename may contain specials (_ or .)
- $docs = array_keys(ft_resultCombine(array_values($matches)));
- $docs = array_filter($docs,'isVisiblePage'); // discard hidden pages
- if(!count($docs)) return $result;
-
- // check metadata for matching links
- foreach($docs as $match){
- // metadata relation reference links are already resolved
- $links = p_get_metadata($match,'relation references');
- if (isset($links[$id])) $result[] = $match;
- }
+ $result = idx_get_indexer()->lookupKey('relation_references', $id);
+ $result = $result[$id];
if(!count($result)) return $result;