[ Index ] |
PHP Cross Reference of DokuWiki |
[Source view] [Print] [Project Stats]
DokuWiki fulltextsearch functions using the index
Author: | Andreas Gohr |
License: | GPL 2 (http://www.gnu.org/licenses/gpl.html) |
File Size: | 1000 lines (32 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
ft_pageSearch($query, &$highlight, $sort = null, $after = null, $before = null) X-Ref |
The fulltext search Returns a list of matching documents for the given query refactored into ft_pageSearch(), _ft_pageSearch() and trigger_event() return: array param: string $query param: array $highlight param: string $sort param: int|string $after only show results with mtime after this date, accepts timestap or strtotime arguments param: int|string $before only show results with mtime before this date, accepts timestap or strtotime arguments |
_ft_pageSearch(&$data) X-Ref |
Returns a list of matching documents for the given query return: array matching documents author: Andreas Gohr <andi@splitbrain.org> author: Kazutaka Miyasaka <kazmiya@gmail.com> param: array $data event data |
ft_backlinks($id, $ignore_perms = false) X-Ref |
Returns the backlinks for a given page Uses the metadata index. return: array The pages that contain links to the given page param: string $id The id for which links shall be returned param: bool $ignore_perms Ignore the fact that pages are hidden or read-protected |
ft_mediause($id, $ignore_perms = false) X-Ref |
Returns the pages that use a given media file Uses the relation media metadata property and the metadata index. Note that before 2013-07-31 the second parameter was the maximum number of results and permissions were ignored. That's why the parameter is now checked to be explicitely set to true (with type bool) in order to be compatible with older uses of the function. return: array A list of pages that use the given media file param: string $id The media id to look for param: bool $ignore_perms Ignore hidden pages and acls (optional, default: false) |
ft_pageLookup($id, $in_ns = false, $in_title = false, $after = null, $before = null) X-Ref |
Quicksearch for pagenames By default it only matches the pagename and ignores the namespace. This can be changed with the second parameter. The third parameter allows to search in titles as well. The function always returns titles as well triggers: SEARCH_QUERY_PAGELOOKUP return: string[] author: Andreas Gohr <andi@splitbrain.org> author: Adrian Lang <lang@cosmocode.de> param: string $id page id param: bool $in_ns match against namespace as well? param: bool $in_title search in title? param: int|string $after only show results with mtime after this date, accepts timestap or strtotime arguments param: int|string $before only show results with mtime before this date, accepts timestap or strtotime arguments |
_ft_pageLookup(&$data) X-Ref |
Returns list of pages as array(pageid => First Heading) return: string[] param: array &$data event data |
_ft_filterResultsByTime(array $results, $after, $before) X-Ref |
return: array param: array $results search results in the form pageid => value param: int|string $after only returns results with mtime after this date, accepts timestap or strtotime arguments param: int|string $before only returns results with mtime after this date, accepts timestap or strtotime arguments |
_ft_pageLookupTitleCompare($search, $title) X-Ref |
Tiny helper function for comparing the searched title with the title from the search index. This function is a wrapper around stripos with adapted argument order and return value. return: bool param: string $search searched title param: string $title title from index |
ft_pagesorter($a, $b) X-Ref |
Sort pages based on their namespace level first, then on their string values. This makes higher hierarchy pages rank higher than lower hierarchy pages. return: int Returns < 0 if $a is less than $b; > 0 if $a is greater than $b, and 0 if they are equal. param: string $a param: string $b |
ft_pagemtimesorter($a, $b) X-Ref |
Sort pages by their mtime, from newest to oldest return: int Returns < 0 if $a is newer than $b, > 0 if $b is newer than $a and 0 if they are of the same age param: string $a param: string $b |
ft_snippet($id, $highlight) X-Ref |
Creates a snippet extract triggers: FULLTEXT_SNIPPET_CREATE return: mixed author: Andreas Gohr <andi@splitbrain.org> param: string $id page id param: array $highlight |
ft_snippet_re_preprocess($term) X-Ref |
Wraps a search term in regex boundary checks. return: string param: string $term |
ft_resultCombine($args) X-Ref |
Combine found documents and sum up their scores This function is used to combine searched words with a logical AND. Only documents available in all arrays are returned. based upon PEAR's PHP_Compat function for array_intersect_key() return: array param: array $args An array of page arrays |
ft_resultUnite($args) X-Ref |
Unites found documents and sum up their scores based upon ft_resultCombine() function return: array author: Kazutaka Miyasaka <kazmiya@gmail.com> param: array $args An array of page arrays |
ft_resultComplement($args) X-Ref |
Computes the difference of documents using page id for comparison nearly identical to PHP5's array_diff_key() return: array author: Kazutaka Miyasaka <kazmiya@gmail.com> param: array $args An array of page arrays |
ft_queryParser($Indexer, $query) X-Ref |
Parses a search query and builds an array of search formulas return: array of search formulas author: Andreas Gohr <andi@splitbrain.org> author: Kazutaka Miyasaka <kazmiya@gmail.com> param: Indexer $Indexer param: string $query search query |
ft_termParser($Indexer, $term, $consider_asian = true, $phrase_mode = false) X-Ref |
Transforms given search term into intermediate representation This function is used in ft_queryParser() and not for general purpose use. return: string author: Kazutaka Miyasaka <kazmiya@gmail.com> param: Indexer $Indexer param: string $term param: bool $consider_asian param: bool $phrase_mode |
ft_queryUnparser_simple(array $and, array $not, array $phrases, array $ns, array $notns) X-Ref |
Recreate a search query string based on parsed parts, doesn't support negated phrases and `OR` searches return: string param: array $and param: array $not param: array $phrases param: array $ns param: array $notns |