mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 09:05:56 +00:00
Enhancement: allow for enabling/disabling advanced search
The advanced searchbox only really functions properly for multiple entities if they all have similar versions. If not, it will let you search on entity-version combinations that might not even exist, which can get confusing.. In such cases optionally disabling it could be a solution, waiting for a better solution (possibly
This commit is contained in:
parent
0bd844e139
commit
9f1f70a065
@ -31,6 +31,11 @@ class DocumentationSearch {
|
|||||||
*/
|
*/
|
||||||
private static $enabled = false;
|
private static $enabled = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool - Is advanced search enabled
|
||||||
|
*/
|
||||||
|
private static $advanced_search_enabled = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string - OpenSearch metadata. Please use {@link DocumentationSearch::set_meta_data()}
|
* @var string - OpenSearch metadata. Please use {@link DocumentationSearch::set_meta_data()}
|
||||||
*/
|
*/
|
||||||
@ -171,6 +176,20 @@ class DocumentationSearch {
|
|||||||
return self::$enabled;
|
return self::$enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable advanced documentation search
|
||||||
|
*/
|
||||||
|
public static function enable_advanced_search($enabled = true) {
|
||||||
|
self::$advanced_search_enabled = ($enabled)? true: false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function advanced_search_enabled() {
|
||||||
|
return self::$advanced_search_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string
|
* @param string
|
||||||
*/
|
*/
|
||||||
|
@ -974,6 +974,17 @@ class DocumentationViewer extends Controller {
|
|||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* check if the Advanced SearchForm can be displayed
|
||||||
|
* enabled by default, to disable use:
|
||||||
|
* DocumentationSearch::enable_advanced_search(false);
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getAdvancedSearchEnabled() {
|
||||||
|
return DocumentationSearch::advanced_search_enabled();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check to see if the currently accessed version is out of date or
|
* Check to see if the currently accessed version is out of date or
|
||||||
* perhaps a future version rather than the stable edition
|
* perhaps a future version rather than the stable edition
|
||||||
|
@ -65,6 +65,13 @@ documentation search needs to be updated on the fly
|
|||||||
|
|
||||||
sake dev/tasks/RebuildLuceneDocsIndex flush=1
|
sake dev/tasks/RebuildLuceneDocsIndex flush=1
|
||||||
|
|
||||||
|
## Advanced Search
|
||||||
|
|
||||||
|
Advanced Search is enabled by default on the searchresults page, allowing you to
|
||||||
|
extend your search over multiple modules and/or versions. Advanced search can
|
||||||
|
be disabled from your _config.php like this:
|
||||||
|
|
||||||
|
DocumentationSearch::enable_advanced_search(false);
|
||||||
|
|
||||||
## Using a URL other than /dev/docs/
|
## Using a URL other than /dev/docs/
|
||||||
|
|
||||||
|
@ -43,10 +43,13 @@
|
|||||||
<% end_if %>
|
<% end_if %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="sidebar-column">
|
<% if AdvancedSearchEnabled %>
|
||||||
<div class="sidebar-box">
|
<div id="sidebar-column">
|
||||||
<h4><% _t('ADVANCEDSEARCH', 'Advanced Search') %></h4>
|
<div class="sidebar-box">
|
||||||
$AdvancedSearchForm
|
<h4><% _t('ADVANCEDSEARCH', 'Advanced Search') %></h4>
|
||||||
|
$AdvancedSearchForm
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<% end_if %>
|
||||||
|
|
||||||
</div>
|
</div>
|
Loading…
x
Reference in New Issue
Block a user