[TYPO3-english] EXT:solr – Use categories as hierarchical facets

Bert Bert
Mon Aug 10 14:59:58 CEST 2015


I try to implement your snippet posted under 
http://blog.steffen-ritter.net/2014/04/extsolr-use-categories-as-hierarchical-facets/.

I am using TYPO3 6.2.12 with Solr 3.0.1...All other features Solr 
delivers just work fine.
Now I want to implement the use of categories (sys_category) with 
News-items (tx_news)...

However, after reindexing the HMENU does not show up on the search-page.

Do I have to put an extra marker somewhere in the templates? What did I 
miss?

Thanks in advance!

Regards,
Bert

PS. Please find below the complete TS for Solr I use...

config.index_enable = 1

plugin.tx_solr {
     solr {
       scheme = http
       host = abc:12345 at mysolrserver.org
       port = 8080
       path = /solr/core_es/
     }
     enableDebugMode = 1
     suggest = 1
     search.elevation = 1

     index {

      fieldProcessingInstructions {
        category_stringM = categoryUidToHierarchy
      }

      queue {
       MYTYPE.fields {
          category_stringM = SOLR_RELATION
          category_stringM {
            localField = categories
            foreignLabelField = uid
            multiValue = 1
          }
       }
       pages = 1
       pages.fields {
         altType_stringS = TEXT
         altType_stringS.value = Paginas
       }
       Bdl = 1
       Bdl {
         table = tx_news_domain_model_news
         additionalWhereClause = pid = {$pidBdl}
         fields {
           abstract = teaser
           title = title
           content = SOLR_CONTENT
           content {
             cObject = COA
             cObject {
               10 = TEXT
               10 {
                  field = bodytext
                  noTrimWrap = || |
               }
             }
           }
           url = TEXT
           url {
             typolink.parameter =  52
             typolink.additionalParams = 
&tx_news_pi1[news]={field:uid}
             typolink.additionalParams.insertData = 1
             typolink.useCacheHash = 1
             typolink.returnLast = url
           }
           # add new field to Bdl
           altType_stringS = TEXT
           altType_stringS.value = Base de Datos Legal
         }
       } #end Bdl

       Blog = 1
       Blog < .Bdl
       Blog {
          additionalWhereClause = pid = {$pidBlog}
          fields {
          # alter value for the other news type
          altType_stringS.value = Blog de ACNUR
          }
       }

       Coi = 1
       Coi < .Bdl
       Coi {
          additionalWhereClause = pid = {$pidCoi}
          fields {
          # alter value for the other news type
          altType_stringS.value = Pais de Origen
          }
       } #end Pais de Origen

       Noticias = 1
       Noticias < .Bdl
       Noticias {
          additionalWhereClause = pid = {$pidNoticias}
          fields {
          # alter value for the other news type
          altType_stringS.value = Noticias
          }
       }

       Enlaces = 1
       Enlaces < .Bdl
       Enlaces {
          additionalWhereClause = pid = {$pidEnlaces}
          fields {
          # alter value for the other news type
          altType_stringS.value = Enlaces de Interes
          }
       }
      }
     }
     search {
       results.resultsHighlighting = 1
       sorting = 1
       spellchecking = 1
       faceting = 1
       results {
             showDocumentScoreAnalysis = 0
             pagebrowser {
                 _LOCAL_LANG.es {
                     text_first = Primero
                     text_prev = Anterior
                     text_next = Siguiente
                     text_last = Ultimo
                 }
             }
       }
       sorting {
             options {
                 relevance {
                     label = Relevancia
                 }
                 title {
                     label = Título
                 }
                 type {
                     label = Tipo
                 }
                 author {
                     label = Autor
                 }
                 created {
                     label = Fecha de creación
                 }
             }
         }
         faceting {
             removeFacetLinkText = @facetText (quitar este filtro)
             facets {
                  #clear type facet
                  type >

                  # enable new field as facet
                  altType_stringS {
                      field = altType_stringS
                      label = Opciones para filtrar
#                     operator = OR
                  }
                  category_stringM {
                     label = Categories
                     field = category_stringM
                     type = hierarchy
                     hierarchy = HMENU
                     hierarchy {
                     1 = TMENU
                     1 {
                       NO = 1
                       NO {
                        wrapItemAndSub = |
                        stdWrap.cObject = RECORDS
                        stdWrap.cObject {
                          source.field = facetKey
                          tables = sys_category
                          dontCheckPid = 1
                          conf.sys_category = TEXT
                          conf.sys_category.field = title
                          conf.sys_category.htmlSpecialChars = 1
                        }
                        stdWrap.dataWrap = |&amp;nbsp;<span 
class="facetoption-result-count">({field:numberOfResults})</span>
                       }


                       CUR = 1
                       CUR < .NO
                       CUR.wrapItemAndSub = |

                       ACT = 1
                       ACT < .NO
                       ACT.wrapItemAndSub = |
                     }

                     2 < .1
                     2.wrap = |

                     3 < .2

                     }
                  }
             }
         }
     }
}





More information about the TYPO3-english mailing list