[TYPO3-english] Solr faceting and categories: restrict results per (set of) category

Bert Bert
Sun Nov 1 10:13:29 CET 2015


Hello,

I have succesfully set up Solr with categories/faceting thanks to this 
article of Steffen Ritter:
http://blog.steffen-ritter.net/2014/04/extsolr-use-categories-as-hierarchical-facets/

However, now I want to restrict the rendering of the results to a 
specific set of categories, depending on the page where the searchbox is 
placed.

How could I restrict the rendering of categories in the case of 
"type=hierarchy")? Please see below for the TS so far (which works fine)...

In which direction should I go:

.facets.queryGroup {

}

.facets.requirements {

}

Other?

Any ideas/pointers? Thanks in advance!

Regards,
Bert

     faceting {
       removeFacetLinkText = <b>@facetText</b>
#      minimumCount = 20
       facets {
         #clear type facet
         type >
         altType_stringS {
           field = altType_stringS
           label = Recurso
           #operator = OR
         }
         category_stringM {
           label = Categorias
           field = category_stringM
           type = hierarchy
           hierarchy = HMENU
           hierarchy {
             1 = TMENU
             1 {
               NO = 1
               NO {
                 doNotLinkIt.stdWrap.cObject = TEXT
                 doNotLinkIt.stdWrap.cObject {
                   override.if.isInList.field = facetKey
                   override.if.value=963,276,237,544,358,307,1743 

                 }
                 wrapItemAndSub = <li>|</li>
                 wrapItemAndSub {
                  # override = <li class="facet-noResults" 
id="fK{field:facetKey}">|</li>
                   override = <div class="btn-group">|</div>
                   override.if.isInList.field = facetKey
                   override.if.value=963,276,237,544,358,307,1743 

                 }
                 wrapItemAndSub.insertData=1
                 stdWrap.htmlSpecialChars = 1
                 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 = <a class="btn btn-default 
dropdown-toggle btn-select" data-toggle="dropdown" href="#">|<span 
class="facetoption-result-count">&nbsp;({field:numberOfResults})&nbsp;</span><span 
class="caret"></span></a>
               }
             }

             2 < .1
             2.wrap = <ul class="dropdown-menu">|</ul>
             2.NO.stdWrap.dataWrap = |<span 
class="facetoption-result-count">&nbsp;({field:numberOfResults})&nbsp;</span>
           #  3 < .2

           }
         }
       }
     }
   }
}


More information about the TYPO3-english mailing list