Configuration typoscript du plugin apache solr
Le 16 novembre 2011, par Sébastien | Catégorie(s) : TYPO3, Typoscript
Imprimer ce post
Après avoir installé le plugin « Apache solr for Typo3″, il faut mettre quelques lignes de TS pour le configurer :
Voici une configuration à mettre dans un gabarit (appelé « solr » par exemple ^^):
dans les constantes :
plugin.tx_solr.solr.host = www.toto.fr => faire des conditions si il y a plusieurs serveurs (dev / val /prod par exemple)
plugin.tx_solr.solr.port = 8080
plugin.tx_solr.solr.scheme = http
plugin.tx_solr.solr.path = /solr/nomdurepertoiresurleserveur/
dans le setup : (certaines lignes sont commentées, à dé-commenter si besoin)
plugin.tx_solr {
addDefaultCss = 1
addDefaultJs = 1
general {
dateFormat.date = d/m/Y
}
index {
enablePageIndexing = 1
enableIndexingWhileBeUserLoggedIn = 1
enableFileIndexingExtractingQuery = 1
additionalFields {
#mytype_sm = TEXT
#mytype_sm.value = {leveltitle:2}
#mytype_sm.insertData= 1
}
// assigns processing instructions to Solr fields during indexing, Solr field = processing instruction
fieldProcessingInstructions {
changed = timestampToIsoDate
created = timestampToIsoDate
endtime = timestampToIsoDate
mytype_sm = pathToHierarchy
}
}
#search {
# TODO: move filter into query{}
# filter =
#targetPage = 0
# allowEmptyQuery = 1
# query {
# fields = content^40.0, title^5.0, keywords^2.0, tagsH1^5.0, tagsH2H3^3.0, tagsH4H5H6^2.0, tagsInline^1.0
# see http://wiki.apache.org/solr/DisMaxRequestHandler#mm_.28Minimum_.27Should.27_Match.29
# minimumMatch =
# see http://wiki.apache.org/solr/DisMaxRequestHandler#bf_.28Boost_Functions.29
# boostFunction =
// TODO implement multiple filters
# filter {
# 10 = x:y
# 20 = a:b
# }
# }
form = simple
# TODO make it a top level configuration section
results {
resultsPerPage = 20
resultsPerPageSwitchOptions = 20, 50, 100
# fieldname => processing instruction, available instructions: timestamp, utf8Decode, skip (removes the field from the result)
fieldProcessingInstructions {
title = utf8Decode
content = utf8Decode
changed = dateFrench
created = timestamp
indexed = timestamp
# TODO rename the skip instruction to remove?!
spell = skip
}
fieldRenderingInstructions {
# additional example rendering for the title field
title2 = TEXT
title2 {
field = title
case = upper
wrap = <span class= »title »>|</span>
}
url = TEXT
url {
field = url
htmlSpecialChars = 1
htmlSpecialChars.preserveEntities = 1
}
}
pagebrowser {
# TODO move to top level templateFile options
#templateFile = fileadmin/templates/extensions/pagebrowse/template.html
}
ignorePageBrowser = 0
}
highlighting = 1
highlighting {
# title and content are set as default in solrconfig.xml already
# highlightFields = title,content
fragmentSize = 500
wrap = <span class= »results-highlight »>|</span>
}
spellchecking = 1
spellchecking {
wrap = |<div class= »spelling-suggestions »>###LLL:didYouMean### |</div>|
}
sorting = 1
sorting {
defaultOrder = asc
fields {
relevancy = 1
relevancy {
label = sorting_relevancy
}
sortTitle = 1
sortTitle {
label = sorting_title
}
type = 1
type {
label = sorting_type
}
sortAuthor = 0
sortAuthor {
label = sorting_author
}
created = 1
created {
label = sorting_created
}
}
}
faceting = 1
faceting {
minimumCount = 1
sortBy = count
limit = 10
singleFacetMode = 1
facetOrder = type, author, myType
facets {
type {
label = Type de document
field = type
missing = 0
}
author {
label = Auteur
field = sortAuthor
}
myType {
label = Rubrique
field = mytype_sm
}
/* Not implemented yet
lastChanged {
label = Last Changed
date =
}
feuser {
label = Created by FE User
query =
TODO
renderingInstruction = TEXT
renderingInstruction {
wrap = <span>|</span>
insertData = 1
}
}
*/
}
// available place holders: @facetValue, @facetName, @facetText
removeFacetLinkText = @facetText (Supprimer)
showAllLink.wrap = <li>|</li>
}
}
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 {
library = EXT:solr/resources/javascript/jquery-1.4.2.min.js
ui = EXT:solr/resources/javascript/jquery-ui-1.8.2.custom.min.js
suggest = EXT:solr/resources/javascript/eid_suggest/suggest.js
}
}
// TODO move to search.results
searchResultsViewComponents {
faceting = 1
sorting = 1
}
viewhelpers {
crop {
maxLength = 30
cropIndicator = …
}
}
logging {
exceptions = 1
// TODO change « indexing » to enable all indexing logging, split up into several options
indexing = 1
indexing{
indexQueuePageIndexerGetData = 1
}
query {
filters = 1
searchWords = 1
queryString = 1
rawPost = 1
rawGet = 1
}
}
Ensuite :
ne pas oublier d’appeler ce TS dans le gabarit principal de votre typo3 puis d’inclure les gabarits statiques de l’extension :
apache solr et pagebrowse.
