summaryrefslogtreecommitdiff
path: root/inc/fulltext.php
diff options
context:
space:
mode:
authorchris <chris@jalakai.co.uk>2006-11-05 20:54:53 +0100
committerchris <chris@jalakai.co.uk>2006-11-05 20:54:53 +0100
commit6b06b65228c9fbd6e8e45658458b14a0e8c2cdfc (patch)
tree119ec17eb7cb4a20b0c893730780eb9522713191 /inc/fulltext.php
parent67cf9a098ec0c4e56817fb5b01e77544a472b78a (diff)
downloadrpg-6b06b65228c9fbd6e8e45658458b14a0e8c2cdfc.tar.gz
rpg-6b06b65228c9fbd6e8e45658458b14a0e8c2cdfc.tar.bz2
backlinks fixes (bugs #795 & #937)
- add deaccented and romanised page names to index word list - remove stop words from tokens used in backlink search darcs-hash:20061105195453-9b6ab-6c4989eb75782af60a3de3bddbc99a83de2b4c80.gz
Diffstat (limited to 'inc/fulltext.php')
-rw-r--r--inc/fulltext.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/inc/fulltext.php b/inc/fulltext.php
index 0d3acb609..448f72248 100644
--- a/inc/fulltext.php
+++ b/inc/fulltext.php
@@ -105,12 +105,14 @@ function ft_pageSearch($query,&$poswords){
*/
function ft_backlinks($id){
global $conf;
+ $swfile = DOKU_INC.'inc/lang/'.$conf['lang'].'/stopwords.txt';
+ $stopwords = @file_exists($swfile) ? file($swfile) : array();
+
$result = array();
// quick lookup of the pagename
$page = noNS($id);
- $sw = array(); // we don't use stopwords here
- $matches = idx_lookup(idx_tokenizer($page,$sw)); // pagename may contain specials (_ or .)
+ $matches = idx_lookup(idx_tokenizer($page,$stopwords)); // 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;
@@ -119,7 +121,7 @@ function ft_backlinks($id){
// check metadata for matching links
foreach($docs as $match){
// metadata relation reference links are already resolved
- $links = p_get_metadata($match,"relation references");
+ $links = p_get_metadata($match,'relation references');
if (isset($links[$id])) $result[] = $match;
}