summaryrefslogtreecommitdiff
path: root/inc/indexer.php
diff options
context:
space:
mode:
authorTom N Harris <tnharris@whoopdedo.org>2010-11-17 17:02:31 -0500
committerTom N Harris <tnharris@whoopdedo.org>2010-11-17 17:02:31 -0500
commit7c2ef4e8d524fb9262c5a08831220f9fb2dc11fe (patch)
tree675816d1de209d15d6131d8a2f7b43eca10e266f /inc/indexer.php
parent1c07b9e622d139fa815c955c89569f96342475fb (diff)
downloadrpg-7c2ef4e8d524fb9262c5a08831220f9fb2dc11fe.tar.gz
rpg-7c2ef4e8d524fb9262c5a08831220f9fb2dc11fe.tar.bz2
Use a different indexer version when external tokenizer is enabled
Diffstat (limited to 'inc/indexer.php')
-rw-r--r--inc/indexer.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/inc/indexer.php b/inc/indexer.php
index 1c955a99d..4914c9fc6 100644
--- a/inc/indexer.php
+++ b/inc/indexer.php
@@ -8,6 +8,9 @@
if(!defined('DOKU_INC')) die('meh.');
+// Version tag used to force rebuild on upgrade
+define('INDEXER_VERSION', 2);
+
// set the minimum token length to use in the index (note, this doesn't apply to numeric tokens)
if (!defined('IDX_MINWORDLENGTH')) define('IDX_MINWORDLENGTH',2);
@@ -43,6 +46,20 @@ define('IDX_ASIAN3','['. // Hiragana/Katakana (can be two charact
define('IDX_ASIAN', '(?:'.IDX_ASIAN1.'|'.IDX_ASIAN2.'|'.IDX_ASIAN3.')');
/**
+ * Version of the indexer taking into consideration the external tokenizer.
+ * The indexer is only compatible with data written by the same version.
+ *
+ * @author Tom N Harris <tnharris@whoopdedo.org>
+ */
+function idx_get_version(){
+ global $conf;
+ if($conf['external_tokenizer'])
+ return INDEXER_VERSION . '+' . trim($conf['tokenizer_cmd']);
+ else
+ return INDEXER_VERSION;
+}
+
+/**
* Measure the length of a string.
* Differs from strlen in handling of asian characters.
*