[TYPO3-Solr] Solr hierarchical facet

Hemalata Jadhav hemalata.jadhav at lelesys.com
Mon Jul 30 08:03:04 CEST 2012


Hello,
I am using EAP 2.7.1

I have 4 categories, each category has multiple sub categories
I want to add facet on these categories.

I need to display the main categories and their respective subcategories 
under it.
1) I have used hierarchical facet as below. This code just displays 
label of facet "Categories" and no categories / subcategories. If I 
remove hierarchical facet TS it shows the categories (no distinction 
between categories and subcategories) in "descending order" of highest 
number of news in a category/subcategory.
Question: What is  the solution for this and what can be wrong in the 
below TS. Empty facets (categories) are not shown. I want those to be to 
also appear.

2) As I want date-range facet where start and end date will be selected 
and on-click of search results should be filtered. With below code I get 
list of dates displayed as "2012-06-13T17:11:49Z (1)".
Question:  is the TS missing some thing ? what configuration may be 
checked to get the desired result ?

3) Question: there are news related to micro-sites (micro-site in under 
main root) and while I am on a particular micro-site I need to list only 
the news of that micro-site. How to configure this?

4) Question: I need to restrict a user group to see some news which is 
paid content. How to I configure paid content.
5) Question: Also I need to show in news result with the category to 
which it is related to?
6) Question: Is there any changes in template that i will have to do to 
get the desired view. Do we need to add some markers for this ?

#Configure Solr
config.index_enable = 1

plugin.tx_solr {
   index.queue {
     tt_news = 1
     tt_news{
       fields {
         abstract = short
         author_stringS = author
         description = short
         title_stringM = title

         content = SOLR_CONTENT
         content {
           field = short
         }

         category_stringM = SOLR_RELATION
         category_stringM {
           localField = category
           multiValue = 1
           # this builds the original page path / hierarchy
           value = {leveltitle:1}/{leveltitle:2}/{leveltitle:3}/
           insertData = 1
         }

         keywords = SOLR_MULTIVALUE
         keywords {
           field = keywords
         }

         url = TEXT
         url {
           typolink.parameter = {$plugin.tt_news.singlePid}
           typolink.additionalParams = 
&tx_ttnews[tt_news]={field:uid}&L={field:__solr_index_language}
           typolink.additionalParams.insertData = 1
           typolink.returnLast = url
           typolink.useCacheHash = 1
         }

         sortAuthor_stringS = author
         sortTitle_stringS  = title
         sortDate_intS = crdate

       }
     }
   }
   suggest = 1
   suggest {
     loadJQuery = 1
     numberOfSuggestions = 10
     suggestField = spell
     forceHttps = 0
     stylesheet = 
EXT:solr/resources/css/jquery-ui/jquery-ui-1.8.2.custom.css
     javaScriptFiles {
       loadIn = footer
       ui    = EXT:solr/resources/javascript/jquery-ui-1.8.2.custom.min.js
       ui.autocomplete = 
EXT:solr/resources/javascript/jquery/jquery-ui.autocomplete.min.js
       suggest  = EXT:solr/resources/javascript/eid_suggest/suggest.js
       faceting.limitExpansion = 
EXT:solr/resources/javascript/pi_results/results.js
       faceting.dateRangeHelper = 
EXT:solr/resources/javascript/pi_results/date_range_facet.js
     }
   }
   search {
     initializeWithEmptyQuery = 1
     showResultsOfInitialEmptyQuery = 1

     results {
       resultsHighlighting = 1
       resultsPerPage = 10
   }

     faceting = 1
     faceting {
       limit = 30
       singleFacetMode = 0
       showEmptyFacets = 1


# ------------------------------------ Question 1----- Start ---------------
       facets {
         category {
           field = category_stringM
           label = Category
           #sortBy = index
           selectingSelectedFacetOptionRemovesFilter = 1
           showEvenWhenEmpty = 1
           keepAllOptionsOnSelection = 1
           #renderer = tx_solr_facet_HierarchicalFacetRenderer
           type = hierarchy
           // the hierarchy facet type is configured using TYPO3's HMENU 
content object
           hierarchy = HMENU
           hierarchy {
             1 = TMENU
             1 {
               NO = 1
               NO {
                 wrapItemAndSub = <li>|</li>
               }
             }

             2 < .1
             2.wrap = <ul>|</ul>

             3 < .2
           }
         }
  # ------------------------------------ Question 1 ----- End 
---------------

# ------------------------------------ Question 2 ----- start 
---------------
         date {
           field = created
           label = Datum

           renderer = tx_solr_facet_DateRangeFacetRenderer
           filterParser = tx_solr_query_filterparser_DateRange

          }
       }
         // available place holders: @facetValue, @facetName, 
@facetLabel, @facetText
       removeFacetLinkText = @facetText
       showAllLink.wrap = <li>|</li>
     }
   }
}
# ------------------------------------ Question 2 ----- End ---------------

plugin.tx_solr.index.fieldProcessingInstructions.category_stringM = 
pathToHierarchy



More information about the TYPO3-project-solr mailing list