Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
shortened new search configs
shorter names are more in line with what we already use, makes less
layout problems in the documentation and is easier to type when telling
people about it.
  • Loading branch information
splitbrain committed Apr 11, 2018
1 parent 37c80e0 commit 13ce475
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions conf/dokuwiki.php
Expand Up @@ -156,8 +156,8 @@
$conf['xsendfile'] = 0; //Use X-Sendfile (1 = lighttpd, 2 = standard)
$conf['renderer_xhtml'] = 'xhtml'; //renderer to use for main page generation
$conf['readdircache'] = 0; //time cache in second for the readdir operation, 0 to deactivate.
$conf['search_limit_to_first_ns'] = 0; //Option to limit the search to the current X namespaces
$conf['search_default_fragment_behaviour'] = 'exact'; // Option to specify the default fragment search behavior
$conf['search_nslimit'] = 0; //limit the search to the current X namespaces
$conf['search_fragment'] = 'exact'; //specify the default fragment search behavior

/* Network Settings */
$conf['dnslookups'] = 1; //disable to disallow IP to hostname lookups
Expand Down
12 changes: 6 additions & 6 deletions inc/Action/Search.php
Expand Up @@ -72,7 +72,7 @@ protected function execute()
}

/**
* Adjust the global query accordingly to the config search_limit_to_first_ns and search_default_fragment_behaviour
* Adjust the global query accordingly to the config search_nslimit and search_fragment
*
* This will only do something if the search didn't originate from the form on the searchpage itself
*/
Expand All @@ -88,16 +88,16 @@ protected function adjustGlobalQuery()
$parsedQuery = ft_queryParser($Indexer, $QUERY);

if (empty($parsedQuery['ns']) && empty($parsedQuery['notns'])) {
if ($conf['search_limit_to_first_ns'] > 0) {
if ($conf['search_nslimit'] > 0) {
if (getNS($ID) !== false) {
$nsParts = explode(':', getNS($ID));
$ns = implode(':', array_slice($nsParts, 0, $conf['search_limit_to_first_ns']));
$ns = implode(':', array_slice($nsParts, 0, $conf['search_nslimit']));
$QUERY .= " @$ns";
}
}
}

if ($conf['search_default_fragment_behaviour'] !== 'exact') {
if ($conf['search_fragment'] !== 'exact') {
if (empty(array_diff($parsedQuery['words'], $parsedQuery['and']))) {
if (strpos($QUERY, '*') === false) {
$queryParts = explode(' ', $QUERY);
Expand All @@ -117,10 +117,10 @@ protected function adjustGlobalQuery()

global $conf;

if ($conf['search_default_fragment_behaviour'] === 'starts_with') {
if ($conf['search_fragment'] === 'starts_with') {
return $part . '*';
}
if ($conf['search_default_fragment_behaviour'] === 'ends_with') {
if ($conf['search_fragment'] === 'ends_with') {
return '*' . $part;
}

Expand Down
12 changes: 6 additions & 6 deletions lib/plugins/config/lang/en/lang.php
Expand Up @@ -178,12 +178,12 @@
$lang['renderer_xhtml'] = 'Renderer to use for main (xhtml) wiki output';
$lang['renderer__core'] = '%s (dokuwiki core)';
$lang['renderer__plugin'] = '%s (plugin)';
$lang['search_limit_to_first_ns'] = 'Limit the search to the current X namespaces. When a search is executed from a page within a deeper namespace, the first X namespaces will be added as filter';
$lang['search_default_fragment_behaviour'] = 'Specify the default fragment search behavior';
$lang['search_default_fragment_behaviour_o_exact'] = 'exact';
$lang['search_default_fragment_behaviour_o_starts_with'] = 'starts with';
$lang['search_default_fragment_behaviour_o_ends_with'] = 'ends with';
$lang['search_default_fragment_behaviour_o_contains'] = 'contains';
$lang['search_nslimit'] = 'Limit the search to the current X namespaces. When a search is executed from a page within a deeper namespace, the first X namespaces will be added as filter';
$lang['search_fragment'] = 'Specify the default fragment search behavior';
$lang['search_fragment_o_exact'] = 'exact';
$lang['search_fragment_o_starts_with'] = 'starts with';
$lang['search_fragment_o_ends_with'] = 'ends with';
$lang['search_fragment_o_contains'] = 'contains';

/* Network Options */
$lang['dnslookups'] = 'DokuWiki will lookup hostnames for remote IP addresses of users editing pages. If you have a slow or non working DNS server or don\'t want this feature, disable this option';
Expand Down
4 changes: 2 additions & 2 deletions lib/plugins/config/settings/config.metadata.php
Expand Up @@ -219,8 +219,8 @@
$meta['xsendfile'] = array('multichoice','_choices' => array(0,1,2,3),'_caution' => 'warning');
$meta['renderer_xhtml'] = array('renderer','_format' => 'xhtml','_choices' => array('xhtml'),'_caution' => 'warning');
$meta['readdircache'] = array('numeric');
$meta['search_limit_to_first_ns'] = array('numeric', '_min' => 0);
$meta['search_default_fragment_behaviour'] = array('multichoice','_choices' => array('exact', 'starts_with', 'ends_with', 'contains'),);
$meta['search_nslimit'] = array('numeric', '_min' => 0);
$meta['search_fragment'] = array('multichoice','_choices' => array('exact', 'starts_with', 'ends_with', 'contains'),);

$meta['_network'] = array('fieldset');
$meta['dnslookups'] = array('onoff');
Expand Down

0 comments on commit 13ce475

Please sign in to comment.