summaryrefslogtreecommitdiff
path: root/_test/tests/inc/indexer_indexing.test.php
diff options
context:
space:
mode:
authorMichael Hamann <michael@content-space.de>2013-12-11 23:02:17 +0100
committerMichael Hamann <michael@content-space.de>2013-12-11 23:09:32 +0100
commit5a1d05488ca6e176af4d195accbdca8010cf3416 (patch)
treeb7e8dd545d6be19f8d0c8527d57cc23f1c2212fb /_test/tests/inc/indexer_indexing.test.php
parentef00962189d77a87a26d132bd84cb7176e96e185 (diff)
downloadrpg-5a1d05488ca6e176af4d195accbdca8010cf3416.tar.gz
rpg-5a1d05488ca6e176af4d195accbdca8010cf3416.tar.bz2
Fix indexing numeric words in page contents
Since a8dba4523d2ecd09dd69a68a36673eaf5c009c57 the search index didn't properly index numeric words anymore, instead they were added as new words to the word list each time they were indexed, leading to an ever-increasing index size.
Diffstat (limited to '_test/tests/inc/indexer_indexing.test.php')
-rw-r--r--_test/tests/inc/indexer_indexing.test.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/_test/tests/inc/indexer_indexing.test.php b/_test/tests/inc/indexer_indexing.test.php
index 628e82e00..3d8278d6c 100644
--- a/_test/tests/inc/indexer_indexing.test.php
+++ b/_test/tests/inc/indexer_indexing.test.php
@@ -42,4 +42,21 @@ class indexer_indexing_test extends DokuWikiTest {
$query = array('001', '01');
$this->assertEquals(array('001' => array(), '01' => array('testpage')), $indexer->lookupKey('numkey', $query));
}
+
+ public function test_numeric_twice() {
+ $indexer = idx_get_indexer();
+ $indexer->addPageWords('testpage', '| 1010 | Dallas |');
+ $query = array('1010');
+ $this->assertEquals(array('1010' => array('testpage' => 1)), $indexer->lookup($query));
+ $indexer->addPageWords('notfound', '| 1010 | Dallas |');
+ $this->assertEquals(array('1010' => array('testpage' => 1, 'notfound' => 1)), $indexer->lookup($query));
+ }
+
+ public function test_numeric_twice_meta() {
+ $indexer = idx_get_indexer();
+ $indexer->addMetaKeys('testpage', 'onezero', array('1010'));
+ $indexer->addMetaKeys('notfound', 'onezero', array('1010'));
+ $query = '1010';
+ $this->assertEquals(array('notfound', 'testpage'), $indexer->lookupKey('onezero', $query));
+ }
} \ No newline at end of file