Project

General

Profile

Actions

Feature #11427

closed

Field Override for indexing

Added by Anonymous almost 14 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Indexed Search
Target version:
Start date:
2010-12-13
Due date:
% Done:

0%

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

Description

It would be nice to have the possibility to override certain fields like item_crdate so you can filter entries by year.

A possible application of this might be tt_news.

This is what has to be added to the method submitPage in tx_indexedsearch_indexer

foreach($conf['overrideConfig.'] as $config) {
    foreach($config as $key => $el) {
        if($key == 'mapping.') {
            foreach($el['override.'] as $k => $v) {
                // Assume that ids that are passed are not deleted
                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                $v,
                $el['table'],
                ' '.$el['tableKey'].'='.$_GET[$el['extKey']][$el['var']]
                );

                $val = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);

                $this->conf[$k] = $val[$v];

            }
        }
    }
}

And this is what has to be added to the method submitFilePage in tx_indexedsearch_indexed:

foreach($conf['overrideConfig.'] as $config) {
    if($config['overrideFiles']) {
        foreach($config as $key => $el) {
            if($key == 'mapping.') {
                foreach($el['override.'] as $k => $v) {
                    // Assume that ids that are passed are not deleted
                    $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                    $v,
                    $el['table'],
                    ' '.$el['tableKey'].'='.$_GET[$el['extKey']][$el['var']]
                    );

                    $val = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);

                    $this->conf[$k] = $val[$v];

                }
            }
        }
    }
}

This is what the config would look like

overrideConfig {
    mapping {
        tt_news {
            table = tt_news
            tableKey = uid
            extKey = tx_ttnews
            // Field to override
            override.item_crdate = tt_news.datetime

            // pi var 
            var = tt_news
        }
    }
    overrideFiles = 1
}

Thanks for youre feedback.

Actions

Also available in: Atom PDF