Project

General

Profile

Actions

Feature #35355

closed

Enhance searchable fields for livesearch

Added by Anonymous over 12 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2012-03-29
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

the list of fields that are being used by the livesearch toolbar in the upper right corner in the TYPO3 backend is filtered by the TCA configuration for that table.

in t3lib/search/class.t3lib_search_livesearch.php the searchable fields per table are being determined by the function extractSearchableFieldsFromTable($tableName):

399     // Traverse configured columns and add them to field array, if available for user.
400     foreach ((array) $GLOBALS['TCA'][$tableName]['columns'] as $fieldName => $fieldValue) {
401             // @todo Reformat
402             if (
403                    (!$fieldValue['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $tableName . ':' . $fieldName)) // does current user have access to the field
404                    &&
405                    ($fieldValue['config']['type'] != 'passthrough') // field type is not searchable
406                    &&
407                    (!preg_match('/date|time|int/', $fieldValue['config']['eval'])) // field can't be of type date, time, int
408                    &&
409                    (
410                         ($fieldValue['config']['type'] == 'text')
411                         ||
412                         ($fieldValue['config']['type'] == 'input')
413                    )
414               ) {
415                    $fieldListArray[] = $fieldName;
416               }
417      }
418
419      // Add special fields:
420      if ($GLOBALS['BE_USER']->isAdmin()) {
421              $fieldListArray[] = 'uid';
422              $fieldListArray[] = 'pid';
423      }

i suggest to enhance that $fieldListArray by a white list of fields for each table that is being determined in the configuration like this:

$GLOBALS['TYPO3_CONF_VARS']['SYS']['livesearch']['content'] = 'tt_content';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['livesearch']['content']['searchableFields'] = 'uid,title,CType,list_type';

the first line is already in the core, enabling the mapping of '#content:1234' to a search request limited to only tt_content and the value 1234.

the second line would be new and enabling the backend user to search for certain plugins, a task that i would like to do in a simple way. searching for tt_news is due to historical reasons a little different since the value for list_type is 9, but for most of the plugins i could use '#content:seminars_pi' to get a list of all seminar plugins.

Actions #1

Updated by Felix Nagel over 12 years ago

Correct me if I'm wrong, but shouldn't this be done by using searchFields in TCA? See http://wiki.typo3.org/TYPO3_4.6#Live_Search

Actions #2

Updated by Anonymous over 12 years ago

thanks for the heads up! i guess, this searchFields can be used for that purpose. currently this seems not to be the case.

Actions #3

Updated by Felix Kopp about 10 years ago

  • Status changed from New to Resolved
Actions #4

Updated by Anonymous about 10 years ago

Ah, this got fixed by Francoir Suter when he worked on #26829. Commit-id cf878c157db8181769e9d2a0d74f19b5b4db3dbf. Thanks ;-)

Actions #5

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF