2. EXT:solr short overview
Search Extension for TYPO3
Started in 2009 (pi based) by Ingo Renner
Code hosted on github: https://github.com/TYPO3-Solr/ext-solr
Financed by dkd and partners
Addons available:
* EXT:solrfal File indexing from FAL for TYPO3
2
3. About me
3
Timo Hund
33 years old
@TYPO3 since: 2003
@Apache Solr since: 2009
@dkd since: 2015
Email: timo.hund@dkd.de
Xing: https://www.xing.com/profile/Timo_Hund2
Github: https://github.com/timohund
Twitter: @TimoHund
13. Concepts & Structure
Concepts & Structure of the FLUID templating in EXT:solr
13(c) by Timo Hund & dkd Internet Service GmbH (Copy for internal use only).
14. Marker based templating
• Default before EXT:solr 7.0.0
(FLUID was not available when EXT:solr was started)
• Extended marker concept of the core (loops, if/else, …), innovative at
that time…
• Limitations
• No Partials
• Limited ViewHelpers
• Additional learning
• Implicite loading of JS and CSS files
• Spreathed logic for url generation
• Templateengine was part of the extension => more maintenance
• PI based (No MVC)
14
15. FLUID based templating
• Since 7.0.0 part of EXT:solr
• Brings
• Domain model for Results/Facets/Sorting/…
• Extbase controllers (MVC & DDD Pattern)
• Default fluid layouts/partials and templates
• ViewHelpers needed for search
• Unified url generation
• Performance improvements
15
19. 19
• Simplified sequence diagram
• The searchAction passes the SearchResultSet to the view
• The SearchResultSet can be used to access results, facets,…
21. Example query and response
http://8.7.local.typo3.org:8083/solr/core_en/select?fl=*,score
&fq=siteHash:“9e9d76a598c63d4ff578fea5c5254c27d9554fc6"
&fq={typo3access}-1,0
&debugQuery=true
&echoParams=all
&spellcheck.maxCollationTries=1
&qf=content^40.0 title^5.0 keywords^2.0 tagsH1^5.0 tagsH2H3^3.0 tagsH4H5H6^2.0 tagsInline&hl=true
&hl.fragsize=200
&hl.fl=content
&facet=true
&facet.mincount=1
&facet.limit=100&facet.field=type
&facet.field=keywords_stringM
&facet.query=created:[NOW/DAY-7DAYS TO *]
&facet.query=created:[NOW/DAY-1MONTH TO NOW/DAY-7DAYS]
&facet.query=created:[NOW/DAY-6MONTHS TO NOW/DAY-1MONTH]
&facet.query=created:[NOW/DAY-1YEAR TO NOW/DAY-6MONTHS]
&facet.query=created:[* TO NOW/DAY-1YEAR]
&facet.sort=count
&wt=json
&json.nl=map&q=cms&start=0&rows=10
21
EXT:solr builds this query
for your and queries the
Apache Solr Server
22. Example query and response
22
Apache Solr delivers a json/xml
response that contains facets, results …
EXT:solr creates the SearchResultSet from
that.
The SearchResultSet can be used to access
all needed data for the output
33. Search resultlist
<f:if condition="{hasSearched}">
<f:if condition="{resultSet.usedSearch.numberOfResults}">
<f:render partial="Result/PerPage" section="PerPage" arguments="{resultSet: resultSet}" />
</f:if>
<s:widget.resultPaginate resultSet="{resultSet}">
<ol start="{pagination.displayRangeStart}" class="results-list">
<f:for each="{documents}" as="document">
<f:render partial="Result/Document" section="Document"
arguments="{resultSet:resultSet, document:document}" />
</f:for>
</ol>
</s:widget.resultPaginate>
</f:if>
33
Every document is passed
to the Results/Document
partial to render the
search result
• You can use: EXT:solr/Resources/Private/Partials/Result/Document.html and
adapt it to your needs.
36. Faceting
• Facets help the user to „narrow down“ or „filter“ the results, to find
what he is looking for.
• Based on a solr field
• Configured with TypoScript
• Have different types
• Option
• Query Group
• Hierarchical
• Date Range
• Numeric Range
36
37. Example
Content type facet of a page:
plugin.tx_solr.search.faceting.facets {
type {
label = Content Type
field = type
type = options*
}
}
*type „options“ is default
37
38. Available option based facets
38
options
hierarchy
queryGroup
Flat list of selectable options
Nested tree of options
Flat list based on solr querys
Example: EXT:solr/Configuration/TypoScript/Examples/Facets/QueryGroup/setup.txt
Example: EXT:solr/Configuration/TypoScript/Examples/Facets/Hierarchy/setup.txt
Default Partial: EXT:solr/Resources/Private/Partials/Facets/Options.html
Default Partial: EXT:solr/Resources/Private/Partials/Facets/Hierarchy.html
Default Partial: EXT:solr/Resources/Private/Partials/Facets/Options.html
39. Available range based facets
39
numericRange
dateRange
Numeric range between a
min and max value
Date range between a start and
end date
Example: EXT:solr/Configuration/TypoScript/Examples/Facets/NumericRange/setup.txt
Example: EXT:solr/Configuration/TypoScript/Examples/Facets/DateRange/setup.txt
Default Partial: EXT:solr/Resources/Private/Partials/Facets/NumericRange.html
Default Partial: EXT:solr/Resources/Private/Partials/Facets/DateRange.html
45. Use custom facet partial
Change the partialName to „Custom“ in TypoScript:
plugin.tx_solr.search.faceting.facets {
category {
label = Category
field = keywords_stringM
type = options
partialName = Custom
}
}
Copy the default partial „Options.html“ to
„Custom.html“
Use the core ViewHelper to make the option uppercase:
{option.label} => <f:format.case value="{option.label}" mode="upper"/>
45
46. Thanks!
46
• To all EB partners !
• Thanks to all contributors!
All previous partners can be found here: http://www.typo3-solr.com/en/sponsors/our-sponsors/
51. Excited and what to learn more?
51
Join the next Apache Solr
for TYPO3 Training or book an
exclusive training for your
company!
Get a 15%
camp
discount
when you book a workshop in
the next 10 days!
52. Do you want to support
Apache Solr for TYPO3?
52
Become an EB
partner and
sponsor the development/
maintenance & support of
Apache Solr for TYPO3