ke_search: eigene Contentelemente indexieren [Gelöst]

  • rookie_37 rookie_37
    Padawan
    0 x
    33 Beiträge
    1 Hilfreiche Beiträge
    28. 03. 2012, 21:10

    Ich habe die Extension ke_search installiert und finde sie wirklich top!

    Mein Problem ist nun aber, dass eigene Inhlatselemente nicht indexiert werden. Ich habe mir ein eigenes Inhaltselement "gebastelt", welches auch in die Tabelle tt_content schreibt, allerdings als Ctype "specialtext" verwendet. Diese Inhalte werden nicht nicht indexiert (text, textpic, shortcut aber schon).

    Wie kann ich dem Indexer beibringen, das CType "detailtext" ebenfalls zu berücksichtigen?


  • 1
  • 0 x
    25 Beiträge
    0 Hilfreiche Beiträge
    30. 03. 2012, 14:01

    Danke. :-)

    Du findest in der Datei

    Vtypo3conf\ext\ke_search\indexer\types\class.tx_kesearch_indexer_types_page.php

    das Array, welches die zu indizierenden CTypes definiert:

    var $indexCTypes = array(
    'text',
    'textpic',
    'bullets',
    'table',
    'html',
    'header'
    );

    Alternativ kannst Du einen eigenen Indexer schreiben:

    http://kesearch.kennziffer.com/dokumentation/ein-eigener-indexer.html

    Christian

  • rookie_37 rookie_37
    Padawan
    0 x
    33 Beiträge
    1 Hilfreiche Beiträge
    15. 04. 2013, 22:18

    Wow, mehr als ein Jahr zu spät, habe diesen Post leider erst jetzt entdeckt :o
    Vielen Dank, das war genau der Punkt.

  • mediew mediew
    T3PO
    0 x
    19 Beiträge
    0 Hilfreiche Beiträge
    18. 06. 2014, 10:55

    Fall hier jemand drauf stößt.

    Es gibt aktuell ein Feature-Request:

    #58631: Make CTypes configurable
    http://forge.typo3.org/issues/58631

    Vorübergehend gibt es auch eine Lösung mittels eines eigenen Indexers.
    ext_localconf.php:

    1. <?php
    2. // ...
    3.  
    4. // register custom indexer hook for EXT:ke_search
    5. $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['registerIndexerConfiguration'][]
    6. = 'EXT:' . $_EXTKEY . '/Classes/Hooks/KeSearchExtenedPagesIndexer.php:KeSearchExtenedPagesIndexer';
    7.  
    8. $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['customIndexer'][]
    9. = 'EXT:' . $_EXTKEY . '/Classes/Hooks/KeSearchExtenedPagesIndexer.php:KeSearchExtenedPagesIndexer';

    KeSearchExtenedPagesIndexer.php

    1. <?php
    2.  
    3. /***************************************************************
    4.  * Copyright notice
    5.  *
    6.  * (c) 2012 Christian Bülter (kennziffer.com) <buelter@kennziffer.com>
    7.  * All rights reserved
    8.  *
    9.  * This script is part of the TYPO3 project. The TYPO3 project is
    10.  * free software; you can redistribute it and/or modify
    11.  * it under the terms of the GNU General Public License as published by
    12.  * the Free Software Foundation; either version 2 of the License, or
    13.  * (at your option) any later version.
    14.  *
    15.  * The GNU General Public License can be found at
    16.  * http://www.gnu.org/copyleft/gpl.html.
    17.  *
    18.  * This script is distributed in the hope that it will be useful,
    19.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    20.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    21.  * GNU General Public License for more details.
    22.  *
    23.  * This copyright notice MUST APPEAR in all copies of the script!
    24.  ***************************************************************/
    25.  
    26. class KeSearchExtenedPagesIndexer {
    27.  
    28. /**
    29.   * Adds the custom indexer to the TCA of indexer configurations, so that
    30.   * it's selectable in the backend as an indexer type when you create a
    31.   * new indexer configuration.
    32.   *
    33.   * @param array $params
    34.   * @param type $pObj
    35.   */
    36. function registerIndexerConfiguration(&$params, $pObj) {
    37.  
    38. // add item to "type" field
    39. $newArray = array(
    40. 'Extend pages',
    41. 'extended_pages',
    42. \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('example') . 'Resources/Public/Icons/kesearch-indexer-extend_pages.gif'
    43. );
    44. $params['items'][] = $newArray;
    45.  
    46. // enable fields in indexer config
    47. $GLOBALS['TCA']['tx_kesearch_indexerconfig']['columns']['fileext']['displayCond'] .= ',extended_pages';
    48. $GLOBALS['TCA']['tx_kesearch_indexerconfig']['columns']['index_content_with_restrictions']['displayCond'] .= ',extended_pages';
    49. $GLOBALS['TCA']['tx_kesearch_indexerconfig']['columns']['index_use_page_tags_for_files']['displayCond'] .= ',extended_pages';
    50. $GLOBALS['TCA']['tx_kesearch_indexerconfig']['columns']['single_pages']['displayCond'] .= ',extended_pages';
    51. $GLOBALS['TCA']['tx_kesearch_indexerconfig']['columns']['startingpoints_recursive']['displayCond'] .= ',extended_pages';
    52. $GLOBALS['TCA']['tx_kesearch_indexerconfig']['columns']['targetpid']['displayCond'] .= ',extended_pages';
    53. $GLOBALS['TCA']['tx_kesearch_indexerconfig']['columns']['targetpid']['displayCond'] .= ',extended_pages';
    54. }
    55.  
    56. /**
    57.   * Custom indexer for ke_search
    58.   *
    59.   * @param array $indexerConfig Configuration from TYPO3 Backend
    60.   * @param array $indexerObject Reference to indexer class.
    61.   * @return string Output.
    62.   */
    63. public function customIndexer(&$indexerConfig, &$indexerObject) {
    64. if($indexerConfig['type'] == 'extended_pages') {
    65. $content = '';
    66.  
    67. // Create new instance from tx_kesearch_indexer_types_page
    68. $keseachIndexerTypesPage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_indexer_types_page');
    69. $keseachIndexerTypesPage->pObj = $indexerObject;
    70. $keseachIndexerTypesPage->indexerConfig = $indexerConfig;
    71.  
    72. // Add own CTypes
    73. $ownCTypes = array(
    74. 'example_1',
    75. 'example_2',
    76. 'example_3',
    77. );
    78. $keseachIndexerTypesPage->indexCTypes = array_merge($keseachIndexerTypesPage->indexCTypes, $ownCTypes);
    79. foreach ($keseachIndexerTypesPage->indexCTypes as $value) {
    80. $cTypes[] = 'CType="' . $value . '"';
    81. }
    82. $keseachIndexerTypesPage->whereClauseForCType = implode(' OR ', $cTypes);
    83.  
    84. // Start indexing
    85. $content = $keseachIndexerTypesPage->startIndexing();
    86.  
    87. return $content;
    88. }
    89. }
    90. }

  • 1