summaryrefslogtreecommitdiff
path: root/inc/fulltext.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2005-11-27 19:07:23 +0100
committerAndreas Gohr <andi@splitbrain.org>2005-11-27 19:07:23 +0100
commitad81d4312bb97f5d88438632707e8c4d561a3914 (patch)
treec528e3213006c411375a48eb5cea833ccb4f9902 /inc/fulltext.php
parent519b3173fdfbf6418e4d1d8df87ec70dac7ffc60 (diff)
downloadrpg-ad81d4312bb97f5d88438632707e8c4d561a3914.tar.gz
rpg-ad81d4312bb97f5d88438632707e8c4d561a3914.tar.bz2
Wildcardsearch added #552 #632
Now searching for word parts is possible by adding or prepending a * character to the searchword: 'foo*' searches for words beginning with 'foo' eg. 'foobar' '*foo' looks for words ending in 'foo' eg. 'barfoo' '*foo*' gets anything with 'foo' in it eg. 'barfoobaz' darcs-hash:20051127180723-7ad00-1eb29e812ddaf38d9812697bb1cffffe9a5fb330.gz
Diffstat (limited to 'inc/fulltext.php')
-rw-r--r--inc/fulltext.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/inc/fulltext.php b/inc/fulltext.php
index f48250548..34520f0c5 100644
--- a/inc/fulltext.php
+++ b/inc/fulltext.php
@@ -19,7 +19,7 @@
function ft_pageSearch($query,&$poswords){
$q = ft_queryParser($query);
// use this for higlighting later:
- $poswords = join(' ',$q['and']);
+ $poswords = str_replace('*','',join(' ',$q['and']));
// lookup all words found in the query
$words = array_merge($q['and'],$q['not']);
@@ -268,7 +268,7 @@ function ft_queryParser($query){
$words = explode(' ',$query);
foreach($words as $w){
if($w{0} == '-'){
- $token = idx_tokenizer($w,$stopwords);
+ $token = idx_tokenizer($w,$stopwords,true);
if(count($token)) $q['not'] = array_merge($q['not'],$token);
}else{
// asian "words" need to be searched as phrases
@@ -276,7 +276,7 @@ function ft_queryParser($query){
$q['phrases'] = array_merge($q['phrases'],$matches[1]);
}
- $token = idx_tokenizer($w,$stopwords);
+ $token = idx_tokenizer($w,$stopwords,true);
if(count($token)) $q['and'] = array_merge($q['and'],$token);
}
}