aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorpetko <petko@524c5546-5005-0410-9a3e-e25e191bd360>2023-09-26 08:54:06 +0000
committerpetko <petko@524c5546-5005-0410-9a3e-e25e191bd360>2023-09-26 08:54:06 +0000
commitdd9c8f66262e3a9209102f637264e6f3d533b1e7 (patch)
tree9eff8fd75c30a213d16b5eb1241455505f01c9f6 /scripts
parentc8c2e0fda9dc746563cb7c0f50f975019c6cd09c (diff)
downloadpmwiki.svn-dd9c8f66262e3a9209102f637264e6f3d533b1e7.tar.bz2
Add $EnableSearchAtLeastOneTerm, default disabled.
git-svn-id: svn://pmwiki.org/pmwiki/trunk@4496 524c5546-5005-0410-9a3e-e25e191bd360
Diffstat (limited to 'scripts')
-rw-r--r--scripts/pagelist.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/scripts/pagelist.php b/scripts/pagelist.php
index b4c77223..d9110bd2 100644
--- a/scripts/pagelist.php
+++ b/scripts/pagelist.php
@@ -390,15 +390,18 @@ function PageListIf(&$list, &$opt, $pn, &$page) {
}
function PageListTermsTargets(&$list, &$opt, $pn, &$page) {
- global $PageIndexTermsFunction, $FmtV;
+ global $PageIndexTermsFunction, $FmtV, $EnableSearchAtLeastOneTerm;
static $reindex = array();
$fold = $GLOBALS['StrFoldFunction'];
switch ($opt['=phase']) {
case PAGELIST_PRE:
$FmtV['$MatchSearched'] = count($list);
- $incl = array(); $excl = array();
- foreach((array)@$opt[''] as $i) { $incl[] = $fold($i); }
+ $incl = $incl1 = $excl = array();
+ if(IsEnabled($EnableSearchAtLeastOneTerm, 0))
+ foreach((array)@$opt[''] as $i) { $incl1[] = $fold($i); }
+ else
+ foreach((array)@$opt[''] as $i) { $incl[] = $fold($i); }
foreach((array)@$opt['+'] as $i) { $incl[] = $fold($i); }
foreach((array)@$opt['-'] as $i) { $excl[] = $fold($i); }
@@ -407,6 +410,8 @@ function PageListTermsTargets(&$list, &$opt, $pn, &$page) {
$delim = (!preg_match('/[^\\w\\x80-\\xff]/', $i)) ? '$' : '/';
$opt['=inclp'][] = $delim . preg_quote($i,$delim) . $delim . 'i';
}
+ if ($incl1)
+ $opt['=inclp'][] = '/'.implode('|', array_map('preg_quote',$incl1)).'/i';
if ($excl)
$opt['=exclp'][] = '$'.implode('|', array_map('preg_quote',$excl)).'$i';
@@ -426,7 +431,6 @@ function PageListTermsTargets(&$list, &$opt, $pn, &$page) {
$opt['=linka'] = array_merge($opt['=linka'], PageListLinkPatterns($c));
}
-
if (@$opt['=cached']) return 0;
if ($indexterms||@$opt['=linka']) {
StopWatch("PageListTermsTargets begin count=".count($list));