summaryrefslogtreecommitdiff
path: root/inc/fulltext.php
diff options
context:
space:
mode:
authorMichael Hamann <michael@content-space.de>2011-01-23 02:00:32 +0100
committerMichael Hamann <michael@content-space.de>2011-01-23 02:06:45 +0100
commit320f489ae6a653f52f9d489b84b9bdd26f4241ac (patch)
tree6ba549bcec2c40d3c8971b484217bb00f750d403 /inc/fulltext.php
parente1e1a7e012189660a2cfd7631e82234b5ae92f69 (diff)
downloadrpg-320f489ae6a653f52f9d489b84b9bdd26f4241ac.tar.gz
rpg-320f489ae6a653f52f9d489b84b9bdd26f4241ac.tar.bz2
Indexer v3 Rewrite: Use the metadata index for backlinks; add INDEXER_METADATA_INDEX event
This new event allows plugins to add or modify the metadata that will be indexed. Collecting this metadata in an event allows plugins to see if other plugins have already added the metadata they need and leads to just one single indexer call thus fewer files are read and written. Plugins could also replace/prevent the metadata indexer call using this event.
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;