[ Index ] |
PHP Cross Reference of DokuWiki |
[Source view] [Print] [Project Stats]
(no description)
File Size: | 1247 lines (42 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
Indexer:: (29 methods):
addPageWords()
getPageWords()
addMetaKeys()
renamePage()
renameMetaValue()
deletePage()
deletePageNoLock()
clear()
tokenizer()
getPID()
getPIDNoLock()
getPageFromPID()
lookup()
lookupKey()
getIndexWords()
getPages()
histogram()
lock()
unlock()
getIndex()
saveIndex()
getIndexKey()
saveIndexKey()
addIndexKey()
listIndexLengths()
indexLengths()
updateTuple()
parseTuples()
countTuples()
addPageWords($page, $text) X-Ref |
Adds the contents of a page to the fulltext index The added text replaces previous words for the same page. An empty value erases the page. author: Tom N Harris <tnharris@whoopdedo.org> author: Andreas Gohr <andi@splitbrain.org> param: string $page a page name param: string $text the body of the page return: string|boolean the function completed successfully |
getPageWords($text) X-Ref |
Split the words in a page and add them to the index. author: Andreas Gohr <andi@splitbrain.org> author: Christopher Smith <chris@jalakai.co.uk> author: Tom N Harris <tnharris@whoopdedo.org> param: string $text content of the page return: array list of word IDs and number of times used |
addMetaKeys($page, $key, $value = null) X-Ref |
Add/update keys to/of the metadata index. Adding new keys does not remove other keys for the page. An empty value will erase the key. The $key parameter can be an array to add multiple keys. $value will not be used if $key is an array. author: Tom N Harris <tnharris@whoopdedo.org> author: Michael Hamann <michael@content-space.de> param: string $page a page name param: mixed $key a key string or array of key=>value pairs param: mixed $value the value or list of values return: boolean|string the function completed successfully |
renamePage($oldpage, $newpage) X-Ref |
Rename a page in the search index without changing the indexed content. This function doesn't check if the old or new name exists in the filesystem. It returns an error if the old page isn't in the page list of the indexer and it deletes all previously indexed content of the new page. param: string $oldpage The old page name param: string $newpage The new page name return: string|bool If the page was successfully renamed, can be a message in the case of an error |
renameMetaValue($key, $oldvalue, $newvalue) X-Ref |
Renames a meta value in the index. This doesn't change the meta value in the pages, it assumes that all pages will be updated. param: string $key The metadata key of which a value shall be changed param: string $oldvalue The old value that shall be renamed param: string $newvalue The new value to which the old value shall be renamed, if exists values will be merged return: bool|string If renaming the value has been successful, false or error message on error. |
deletePage($page) X-Ref |
Remove a page from the index Erases entries in all known indexes. author: Tom N Harris <tnharris@whoopdedo.org> param: string $page a page name return: string|boolean the function completed successfully |
deletePageNoLock($page) X-Ref |
Remove a page from the index without locking the index, only use this function if the index is already locked Erases entries in all known indexes. author: Tom N Harris <tnharris@whoopdedo.org> param: string $page a page name return: boolean the function completed successfully |
clear() X-Ref |
Clear the whole index return: bool If the index has been cleared successfully |
tokenizer($text, $wc = false) X-Ref |
Split the text into words for fulltext search TODO: does this also need &$stopwords ? triggers: INDEXER_TEXT_PREPARE author: Tom N Harris <tnharris@whoopdedo.org> author: Andreas Gohr <andi@splitbrain.org> param: string $text plain text param: boolean $wc are wildcards allowed? return: array list of words in the text |
getPID($page) X-Ref |
Get the numeric PID of a page param: string $page The page to get the PID for return: bool|int The page id on success, false on error |
getPIDNoLock($page) X-Ref |
Get the numeric PID of a page without locking the index. Only use this function when the index is already locked. param: string $page The page to get the PID for return: bool|int The page id on success, false on error |
getPageFromPID($pid) X-Ref |
Get the page id of a numeric PID param: int $pid The PID to get the page id for return: string The page id |
lookup(&$tokens) X-Ref |
Find pages in the fulltext index containing the words, The search words must be pre-tokenized, meaning only letters and numbers with an optional wildcard 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 appears on the page as value. author: Tom N Harris <tnharris@whoopdedo.org> author: Andreas Gohr <andi@splitbrain.org> param: array $tokens list of words to search for return: array list of page names with usage counts |
lookupKey($key, &$value, $func = null) X-Ref |
Find pages containing a metadata key. The metadata values are compared as case-sensitive strings. Pass a callback function that returns true or false to use a different 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. The function preg_match can be used directly if the values are regexes. author: Tom N Harris <tnharris@whoopdedo.org> author: Michael Hamann <michael@content-space.de> param: string $key name of the metadata key to look for param: string $value search term to look for, must be a string or array of strings param: callback $func comparison function return: array lists with page names, keys are query values if $value is array |
getIndexWords(&$words, &$result) X-Ref |
Find the index ID of each search term. The query terms should only contain valid characters, with a '*' at either the beginning or end of the word (or both). The $result parameter can be used to merge the index locations with the appropriate query term. author: Tom N Harris <tnharris@whoopdedo.org> param: array $words The query terms. param: array $result Set to word => array("length*id" ...) return: array Set to length => array(id ...) |
getPages($key = null) X-Ref |
Return a list of all pages Warning: pages may not exist! author: Tom N Harris <tnharris@whoopdedo.org> param: string $key list only pages containing the metadata key (optional) return: array list of page names |
histogram($min = 1, $max = 0, $minlen = 3, $key = null) X-Ref |
Return a list of words sorted by number of times used author: Tom N Harris <tnharris@whoopdedo.org> param: int $min bottom frequency threshold param: int $max upper frequency limit. No limit if $max<$min param: int $minlen minimum length of words to count param: string $key metadata key to list. Uses the fulltext index if not given return: array list of words as the keys and frequency as values |
lock() X-Ref |
Lock the indexer. author: Tom N Harris <tnharris@whoopdedo.org> return: bool|string |
unlock() X-Ref |
Release the indexer lock. author: Tom N Harris <tnharris@whoopdedo.org> return: bool |
getIndex($idx, $suffix) X-Ref |
Retrieve the entire index. The $suffix argument is for an index that is split into multiple parts. Different index files should use different base names. author: Tom N Harris <tnharris@whoopdedo.org> param: string $idx name of the index param: string $suffix subpart identifier return: array list of lines without CR or LF |
saveIndex($idx, $suffix, &$lines) X-Ref |
Replace the contents of the index with an array. author: Tom N Harris <tnharris@whoopdedo.org> param: string $idx name of the index param: string $suffix subpart identifier param: array $lines list of lines without LF return: bool If saving succeeded |
getIndexKey($idx, $suffix, $id) X-Ref |
Retrieve a line from the index. author: Tom N Harris <tnharris@whoopdedo.org> param: string $idx name of the index param: string $suffix subpart identifier param: int $id the line number return: string a line with trailing whitespace removed |
saveIndexKey($idx, $suffix, $id, $line) X-Ref |
Write a line into the index. author: Tom N Harris <tnharris@whoopdedo.org> param: string $idx name of the index param: string $suffix subpart identifier param: int $id the line number param: string $line line to write return: bool If saving succeeded |
addIndexKey($idx, $suffix, $value) X-Ref |
Retrieve or insert a value in the index. author: Tom N Harris <tnharris@whoopdedo.org> param: string $idx name of the index param: string $suffix subpart identifier param: string $value line to find in the index return: int|bool line number of the value in the index or false if writing the index failed |
listIndexLengths() X-Ref |
Get the list of lengths indexed in the wiki. Read the index directory or a cache file and returns a sorted array of lengths of the words used in the wiki. author: YoBoY <yoboy.leguesh@gmail.com> return: array |
indexLengths($filter) X-Ref |
Get the word lengths that have been indexed. Reads the index directory and returns an array of lengths that there are indices for. author: YoBoY <yoboy.leguesh@gmail.com> param: array|int $filter return: array |
updateTuple($line, $id, $count) X-Ref |
Insert or replace a tuple in a line. author: Tom N Harris <tnharris@whoopdedo.org> param: string $line param: string|int $id param: int $count return: string |
parseTuples(&$keys, $line) X-Ref |
Split a line into an array of tuples. author: Tom N Harris <tnharris@whoopdedo.org> author: Andreas Gohr <andi@splitbrain.org> param: array $keys param: string $line return: array |
countTuples($line) X-Ref |
Sum the counts in a list of tuples. author: Tom N Harris <tnharris@whoopdedo.org> param: string $line return: int |