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:
martimiz 2013-01-07 16:53:33 +01:00
parent 5bf5da4c92
commit 0bd844e139

View File

@ -816,10 +816,19 @@ class DocumentationViewer extends Controller {
if(!DocumentationSearch::enabled()) return false;
$q = ($q = $this->getSearchQuery()) ? $q->NoHTML() : "";
$entities = $this->getSearchedEntities();
$versions = $this->getSearchedVersions();
$fields = new FieldList(
new TextField('Search', _t('DocumentationViewer.SEARCH', 'Search'), $q),
new HiddenField('Entities', '', implode(',', array_keys($this->getSearchedEntities()))),
new HiddenField('Versions', '', implode(',', $this->getSearchedVersions()))
new TextField('Search', _t('DocumentationViewer.SEARCH', 'Search'), $q)
);
if ($entities) $fields->push(
new HiddenField('Entities', '', implode(',', array_keys($entities)))
);
if ($versions) $fields->push(
new HiddenField('Versions', '', implode(',', $versions))
);
$actions = new FieldList(