Feature #11427

Field Override for indexing

Added by Anonymous over 8 years ago. Updated over 3 years ago.

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

0%

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.

History

#1 Updated by Jonas Felix over 8 years ago

This is a very nice solution I tested it.
I used it to insert event dates into the search index, this way users can sort by the event starting date within indexed search!
Nice one Tizian! Thank you ver much!

Please check and integrate that into indexed_search!

#2 Updated by Oliver Hader about 6 years ago

  • Target version set to 2222

#3 Updated by Oliver Hader about 6 years ago

  • Project changed from Indexed Search to TYPO3 Core

#4 Updated by Oliver Hader about 6 years ago

  • Category set to Indexed Search

#5 Updated by Oliver Hader about 6 years ago

  • Target version deleted (2222)

#6 Updated by Mathias Schreiber over 4 years ago

  • Target version set to 7.5

#7 Updated by Benni Mack over 3 years ago

  • Target version changed from 7.5 to 7 LTS

Also available in: Atom PDF