solrtypo3typoscript

TYPO3 solr index custom database fields


TYPO3 version: 12.4
EXT:solr version: 12.0.5

I have a TYPO3 site with Solr indexing for pages and news. I also have a product database which I want to search in as well. I tried adding the table to my Solr TypoScript but I have trouble adding the article_number to my indexing.

plugin.tx_solr {
    statistics = 1
    view.templateRootPaths.10 = EXT:my_project/Resources/Private/Templates/Extensions/Solr/
    view.partialRootPaths.10 = EXT:my_project/Resources/Private/Partials/Extensions/Solr/
    view.layoutRootPaths.10 = EXT:my_project/Resources/Private/Layouts/Extensions/Solr/

    search {
        results {
            resultsPerPage = 999
        }
        faceting = 0
        faceting {
            facets {
                type >
            }
        }
    }
    index {
        queue {
            tx_my_project_domain_model_product = 1
            tx_my_project_domain_model_product.table = tx_my_project_domain_model_product
            tx_my_project_domain_model_product.fields {
                product_article_number = SOLR_CONTENT
                product_article_number {
                    cObject = TEXT
                    cObject {
                        field = article_number
                    }
                }
                title = article_name
                url = TEXT
                own_article_gtin_textS = own_article_gtin
                kind_textS = kind
                price_stringS = price
                description_short_textS = description_short
                erp_description_textS = erp_description
                url = TEXT
                url {
                    typolink {
                        parameter = {$config.pages.products}
                        additionalParams.data = field:uid
                        additionalParams.wrap = &tx_my_project_product[action]=details&tx_my_project_product[controller]=Product&tx_my_project_product[product_id]=|
                        returnLast = url
                    }
                }
                featuredImage_stringS = FILES
                featuredImage_stringS {
                    references {
                        table = tx_my_project_domain_model_product
                        uid.data = {field:uid}
                        fieldName = featured_image
                    }
                    begin = 0
                    maxItems = 1
                    renderObj = IMG_RESOURCE
                    renderObj {
                        file {
                            import.data = file:current:publicUrl
                            treatIdAsReference = 1
                            width = 370c
                        }
                    }
                }
            }
        }
    }
}

Result in backend:

I would have expected product_article_number to be present here, but it doesn't show. I cleared caches, reloaded Solr configuration and reindex the entire site. How do i add the product_article_number here?

enter image description here


Solution

  • You want to use dynamic fields.
    See: https://docs.typo3.org/p/apache-solr-for-typo3/solr/main/en-us/Appendix/DynamicFieldTypes.html
    So for example:

    product_article_number_stringS or/and product_article_number_stringEdgeNgramS