summaryrefslogtreecommitdiff
path: root/inc/indexer.php
diff options
context:
space:
mode:
authorTom N Harris <tnharris@whoopdedo.org>2011-02-22 02:14:05 -0500
committerTom N Harris <tnharris@whoopdedo.org>2011-02-22 02:14:05 -0500
commitb00bd361a6fb93d2ef2433f18f3f238a7498c041 (patch)
treebee84f50af32dcdc1b5c56413070b86ca1022463 /inc/indexer.php
parentc1209673030dd03537a2ece21331203ff0a6bf34 (diff)
downloadrpg-b00bd361a6fb93d2ef2433f18f3f238a7498c041.tar.gz
rpg-b00bd361a6fb93d2ef2433f18f3f238a7498c041.tar.bz2
Indexer::lookupKey callback receives value reference as first arg
Diffstat (limited to 'inc/indexer.php')
-rw-r--r--inc/indexer.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/inc/indexer.php b/inc/indexer.php
index b6a586985..0e0340d40 100644
--- a/inc/indexer.php
+++ b/inc/indexer.php
@@ -422,7 +422,7 @@ class Doku_Indexer {
*
* The returned array will have the original tokens as key. The values
* in the returned list is an array with the page names as keys and the
- * number of times that token appeas on the page as value.
+ * number of times that token appears on the page as value.
*
* @param arrayref $tokens list of words to search for
* @return array list of page names with usage counts
@@ -468,16 +468,18 @@ class Doku_Indexer {
*
* The metadata values are compared as case-sensitive strings. Pass a
* callback function that returns true or false to use a different
- * comparison function
+ * comparison function. The function will be called with the $value being
+ * searched for as the first argument, and the word in the index as the
+ * second argument.
*
* @param string $key name of the metadata key to look for
* @param string $value search term to look for
* @param callback $func comparison function
- * @return array lists with page names, keys are query values if $key is array
+ * @return array lists with page names, keys are query values if $value is array
* @author Tom N Harris <tnharris@whoopdedo.org>
* @author Michael Hamann <michael@content-space.de>
*/
- public function lookupKey($key, $value, $func=null) {
+ public function lookupKey($key, &$value, $func=null) {
if (!is_array($value))
$value_array = array($value);
else
@@ -496,9 +498,9 @@ class Doku_Indexer {
}
if (!is_null($func)) {
- foreach ($value_array as $val) {
+ foreach ($value_array as &$val) {
foreach ($words as $i => $word) {
- if (call_user_func_array($func, array($word, $val)))
+ if (call_user_func_array($func, array(&$val, $word)))
$value_ids[$i][] = $val;
}
}