[TYPO3-Solr] Show search result grouped by facet
Ingo Renner
ingo at typo3.org
Thu Oct 27 19:03:26 CEST 2011
Am 27.10.11 16:13, schrieb Peter Kraume:
Hi Peter,
> do you have a hint for me, how I can show the search result grouped by
> facet?
>
> I have three facets:
> - website (pages)
> - FAQ entries
> - files
To get some naming straight: In this case I guess you mean you have _one
facet_ (type) with _three options_.
> The search result page should look like this:
>
>
> Website facet
> - result entry 1
> - result entry 2
> - result entry 3
> - Button [show all website results] (loaded via ajax like Twitter timeline)
>
> FAQ facet
> - faq entry 1
> - faq entry 2
> - faq entry 3
> - Button [show all FAQ results] (loaded via ajax like Twitter timeline)
>
> Files facet
> - file result 1
> - file result 2
> - file result 3
> - Button [show all file results] (loaded via ajax like Twitter timeline)
>
> Do you have any hints for me how to accomplish this?
You can achieve this the following way (also mentioned earlier in the ML
;) ):
1) enable / set tx_solr.search.results.markResultTypeBoundaries = 1
2) sort by type
3) documents get added result type boundary marker fields name typeBegin
and typeEnd with the values <type>_begin and <type>_end
4) add conditions in the template to display/hide stuff when those
fields are encountered.
http://forge.typo3.org/projects/extension-solr/wiki/Tx_solrsearch#resultsmarkResultTypeBoundaries
Available from dkd EAP revisions 81433/81434
Example template snippet:
<!-- ###LOOP:RESULT_DOCUMENTS### begin -->
<!-- ###LOOP_CONTENT### -->
<!-- ###IF:###RESULT_DOCUMENT.typeBegin###|==|pages_begin### begin -->
<li>Pages</li>
<!-- ###IF:###RESULT_DOCUMENT.typeBegin###|==|pages_begin### end -->
<!-- ###IF:###RESULT_DOCUMENT.typeBegin###|==|tt_news_begin### begin -->
<li>News</li>
<!-- ###IF:###RESULT_DOCUMENT.typeBegin###|==|tt_news_begin### end -->
<! -- ... more markup here ... -->
<!-- ###LOOP_CONTENT### -->
<!-- ###LOOP:RESULT_DOCUMENTS### end -->
best
Ingo
--
Ingo Renner
TYPO3 Core Developer, Release Manager TYPO3 4.2, Admin Google Summer of Code
TYPO3 - Open Source Enterprise Content Management System
http://typo3.org
Apache Solr for TYPO3 -
Open Source Enterprise Search meets Open Source Enterprise CMS
http://www.typo3-solr.com
More information about the TYPO3-project-solr
mailing list