mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 11:05:56 +02:00
Fix: no search results found on documentation homepage
On the homepage there are no searchedEntities nor searchedVersions defined, so the searchForm creates empty hiddenfields. PerformSeach creates subqueries for thes empty values resulting in the return of an 'Empty' query object. Solution: do not create these fields when there are no entities/versions
This commit is contained in:
parent
5bf5da4c92
commit
0bd844e139
@ -816,10 +816,19 @@ class DocumentationViewer extends Controller {
|
|||||||
if(!DocumentationSearch::enabled()) return false;
|
if(!DocumentationSearch::enabled()) return false;
|
||||||
$q = ($q = $this->getSearchQuery()) ? $q->NoHTML() : "";
|
$q = ($q = $this->getSearchQuery()) ? $q->NoHTML() : "";
|
||||||
|
|
||||||
|
$entities = $this->getSearchedEntities();
|
||||||
|
$versions = $this->getSearchedVersions();
|
||||||
|
|
||||||
$fields = new FieldList(
|
$fields = new FieldList(
|
||||||
new TextField('Search', _t('DocumentationViewer.SEARCH', 'Search'), $q),
|
new TextField('Search', _t('DocumentationViewer.SEARCH', 'Search'), $q)
|
||||||
new HiddenField('Entities', '', implode(',', array_keys($this->getSearchedEntities()))),
|
);
|
||||||
new HiddenField('Versions', '', implode(',', $this->getSearchedVersions()))
|
|
||||||
|
if ($entities) $fields->push(
|
||||||
|
new HiddenField('Entities', '', implode(',', array_keys($entities)))
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($versions) $fields->push(
|
||||||
|
new HiddenField('Versions', '', implode(',', $versions))
|
||||||
);
|
);
|
||||||
|
|
||||||
$actions = new FieldList(
|
$actions = new FieldList(
|
||||||
|
Loading…
Reference in New Issue
Block a user