Issue Bug Closed

#83301ListView search returns all elements

Hannes Lau 12/12/17, 14:20 updated 10/02/18, 10:53

Description

This issue is on the search function of the list module in the TYPO3 BE. Not the live search in the BE, not about FE searches.

Steps to reproduce
  • TYPO3 8.7
  • Log into the BE as an admin
  • Activate the “Indexed Search” extension
  • Switch to the list module
  • Create an indexed search configuration record (anywhere). Save and close.
  • Click the search icon in the header of the list view (Not the live search at the top right)
  • Enter a random search word like “aPPnmtdkRE”

Expected result: No items should be found at all
Actual result: The indexed search configuration will be found (allthough it does not contain ‘aPPnmtdkRE’.

typo3/sysext/recordlist/Classes/RecordList/AbstractDatabaseRecordList.php:922

public function makeSearchString($table, $currentPid = -1)
        …
        $searchableFields = $this->getSearchFields($table);
        if (empty($searchableFields)) {
            return '';
        }
If getSearchFields returns [], the searchString constraint is returned as ''. This results to no search constraint for the given table at all. Instead we should either
  • Search all fields of the given table
  • Return false, to remove the table from the search results entirely.

Reviews 2