This shows you the differences between two versions of the page.
search_syntax [2017/05/30 08:44] COMFILE Technology created |
search_syntax [2017/05/30 08:44] (current) COMFILE Technology created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Search Syntax ====== | ||
+ | Basically DokuWiki performs logical AND search. That means all the words you put in the query will be used. Search is always case insensitive. | ||
+ | |||
+ | DokuWiki's advanced search query syntaxes are described below. All of the syntaxes can be combined together. In this section, we'll use square brackets ''[ ... ]'' to represent characters entered in the query. | ||
+ | |||
+ | ===== Terms you want to exclude (-) ===== | ||
+ | |||
+ | You can attach a minus sign ''-'' immediately before a keyword to exclude pages that contain this keyword from your search results. For example, the query ''[ dokuwiki -plugin ]'' will find pages which contain "DokuWiki" but do not contain "plugin". | ||
+ | |||
+ | You can use this syntax ''-'' not just for a keyword, but also for a partial matching, a phrase search, a namespace search and a grouping search described below. For example, you can use the query ''%%[ -"phrase you want to exclude" ]%%'' to exclude exact phrase. | ||
+ | |||
+ | ===== Partial matching (*) ===== | ||
+ | |||
+ | You can perform a partial matching by prefixing and/or suffixing an asterisk ''*'' to a keyword. For example, searching for ''[ wiki ]'' will only find "wiki", but searching for ''[ *wiki ]'' will also find "DokuWiki" (suffix matching). You can also perform ''[ doku* ]'' (prefix matching) and ''[ *okuwik* ]'' (partial matching). | ||
+ | |||
+ | Note that ''*'' is not a "wildcard". You can't use it within a keyword, i.e. searching ''[ doku*iki ]'' will not find anything for you. | ||
+ | |||
+ | ===== Phrase search ("") ===== | ||
+ | |||
+ | You can search for exact phrases by putting double quotes around a set of words, e.g. ''%%[ "installing dokuwiki" ]%%''. | ||
+ | |||
+ | ===== Search within a namespace (@) ===== | ||
+ | |||
+ | You can restrict the search to namespaces. To search pages within a namespace, prefix ''@'' or ''ns:'' to the namespace. To not search pages within a namespace, prefix ''^'' or ''-ns:'' to the namespace. | ||
+ | |||
+ | For example, the query ''[ dokuwiki @wiki ^wiki:docs ]'' will find pages which contain a word "dokuwiki" and are within "wiki" namespace but not within "wiki:docs" namespace. The query ''[ dokuwiki ns:wiki -ns:wiki:docs ]'' will do the same thing. | ||
+ | |||
+ | ===== The OR operator (|) ===== | ||
+ | |||
+ | By default DokuWiki performs a logical AND search, but you can also use a logical OR search by using ''|'' or ''or'' as a separator of your search terms. For example, the query ''[ plugin | template ]'' will find pages which contain either "plugin" or "template" or both. The query ''[ plugin or template ]'' will do the same thing. You may use OR as a simple alternative to [[#Partial matching (*)]], e.g. in finding pages about people with spelling variations as ''[ Frank | Fränk ]''. | ||
+ | |||
+ | The OR operator has a lower precedence than the default AND operator. That is, the query ''[ dokuwiki plugin | template ]'' can be represented as ''[ (dokuwiki plugin) | template ]'', not as ''[ dokuwiki (plugin | template) ]''. Instead, use a grouping syntax as described below. | ||
+ | |||
+ | If you want to [[#Search within a namespace (@) |restrict your search on a namespace]], you **have** to group your search with "()", otherwise a search ''[ plugin | template @plugin]'' will behave as ''[ (plugin) | (template @plugin)]'', i.e. searching for "plugin" OR "template @plugin" over //all// namespaces, but not as you may intend searching "plugin" OR "template" over the //plugin// namespace, the latter being correctly expressed as ''[ (plugin | template) @plugin]''. | ||
+ | |||
+ | ===== Grouping search ===== | ||
+ | |||
+ | You can group search terms by enclosing terms with parentheses ''( ... )''. Having the highest precedence, parentheses may be used to force precedence. | ||
+ | |||
+ | For example, the query ''[ dokuwiki -(plugin | @plugin) ]'' will find pages which contain a word "DokuWiki" but not contain a word "plugin" and also are not within a namespace "plugin". |