summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--_test/tests/inc/search/search.test.php4
-rw-r--r--inc/search.php4
2 files changed, 4 insertions, 4 deletions
diff --git a/_test/tests/inc/search/search.test.php b/_test/tests/inc/search/search.test.php
index 9c854a661..33d4e9d8d 100644
--- a/_test/tests/inc/search/search.test.php
+++ b/_test/tests/inc/search/search.test.php
@@ -22,9 +22,9 @@ class search_test extends DokuWikiTest {
search($data, dirname(__FILE__) . '/data', 'search_allpages', array('depth' => 1), 'ns1/ns3');
$this->assertEquals(0, count($data));
- //depth is 1 so I should get only pages from ns1
+ //depth is 2 so I should get only pages from ns1
$data = array();
- search($data, dirname(__FILE__) . '/data', 'search_allpages', array('depth' => 1), 'ns1');
+ search($data, dirname(__FILE__) . '/data', 'search_allpages', array('depth' => 2), 'ns1');
$this->assertEquals(2, count($data));
}
diff --git a/inc/search.php b/inc/search.php
index e4aa3b9eb..6927fff5f 100644
--- a/inc/search.php
+++ b/inc/search.php
@@ -243,8 +243,8 @@ function search_pagename(&$data,$base,$file,$type,$lvl,$opts){
function search_allpages(&$data,$base,$file,$type,$lvl,$opts){
if(isset($opts['depth']) && $opts['depth']){
$parts = explode('/',ltrim($file,'/'));
- if(($type == 'd' && count($parts) > $opts['depth'])
- || ($type != 'd' && count($parts) > $opts['depth'] + 1)){
+ if(($type == 'd' && count($parts) >= $opts['depth'])
+ || ($type != 'd' && count($parts) > $opts['depth'])){
return false; // depth reached
}
}