TYPO3 Solr: How to add additional fields to indexer? - solr

[TYPO3 8.7, ext_solr 9.0]
I have a custom extension for events. Solr should index the field startdate but doesn't. Everything else works fine.
plugin.tx_solr.index.queue {
events = 1
events {
table = tx_customevents_domain_model_event
fields {
title = title
abstract = teaser
startdate_intS = startdate
content = SOLR_CONTENT
content {
field = bodytext
}
url = TEXT
url {
typolink {
parameter = {$plugin.tx_customevents_list.settings.singelePid}
additionalParams = &tx_customevents_list[event]={field:uid}&tx_customevents_list[action]=show&tx_customevents_list[controller]=Event
additionalParams.insertData = 1
returnLast = url
useCacheHash = 1
}
}
}
}
}
plugin.tx_solr.search.query.queryFields := addToList(startdate_intS^1.0)
The Fluid debugger does not show it in the resultSet object, even after having emptied the index queue.
What am I missing here?

Related

Typo3 solr facets formed by multiple values

I need to have two languages rendered all the time in every text all around the site.
I was being able to solve all the issues that need task gave me. Until I came around the solr facets.
In order to display the categories filter that I've set in facets in both languages (something like "Category / Categoria") seems that I need to create a facet formed by two fields.
I don't understand much about typoscript I just use it.
Is there a way to concatenate two fields in one facet with a string in the middle?
Like categorytitlehr_stringM . / . categorytitlede_stringM
plugin.tx_solr{
search {
query.queryFields := addToList(categorytitle_stringM^2.0,keywords2.0,tags_textM^2.0,personname_textM^2.0,descriptionhr_textS^2.0,description_textS^2.0)
faceting = 1
faceting {
facets {
categories_hr {
field = categorytitlehr_stringM
label = Categories HR
partialName = Categories
}
categories_de {
field = categorytitlede_stringM
label = Categories DE
partialName = Categories
}
}
}
}
index.queue {
custom_news = 1
custom_news {
table = tx_news_domain_model_news
fields {
abstract = teaser
author = author
authorEmail_stringS = author_email
title = title
...
categorytitlehr_stringM = SOLR_RELATION
categorytitlehr_stringM {
localField = categories
foreignLabelField = title_hr
multiValue = 1
}
categorytitlede_stringM = SOLR_RELATION
categorytitlede_stringM {
localField = categories
foreignLabelField = title_de
multiValue = 1
}
...
url = CASE
url {
key.field = type
# Internal
1 = TEXT
1 {
if.isTrue.field = internalurl
typolink.parameter.field = internalurl
typolink.useCacheHash = 1
typolink.returnLast = url
}
# External
2 = TEXT
2 {
if.isTrue.field = externalurl
field = externalurl
}
default = TEXT
default {
typolink.parameter = {$plugin.tx_news.settings.detailPid}
typolink.additionalParams = &tx_news_pi1[controller]=News&tx_news_pi1[action]=detail&tx_news_pi1[news]={field:uid}&L={field:__solr_index_language}
typolink.additionalParams.insertData = 1
typolink.useCacheHash = 1
typolink.returnLast = url
}
}
}
attachments = 1
attachments {
fields = fal_related_files
fileExtensions = *
}
}
}
}

How does "plugin.tx_solr.query.fields " work?

I need to be able to search by the News Tags property.
This typoscript is working fine, but when I input a tag (exact same string) from a News into Solr's search box I don't get any results.
According to "lorenz" in this answer I neede to add my dynamic fields (I believe) to "plugin.tx_solr.query.fields" but this poor documentation doesn't help me.
I added the following to that typoscript but when I use the searchbox to look for exactly the name of my tag I get no results.
(plugin.tx_solr.query.fields = tags_stringM)
Does anybody have any code that I can use as an example?
plugin.tx_solr{
search {
initializeWithEmptyQuery = 1
showResultsOfInitialEmptyQuery = 1
showEmptyFacets = 1
faceting = 1
faceting {
facets {
mediatype {
label = Facet dos
field = categorytitle_stringS
}
}
}
}
index.queue {
custom_news = 1
custom_news {
table = tx_news_domain_model_news
fields {
abstract = teaser
author = author
authorEmail_stringS = author_email
title = title
datetime_stringS = TEXT
datetime_stringS {
field = datetime
date = d.m.Y H:i
}
titlehr_stringS = TEXT
titlehr_stringS {
field = title_hr
}
teaser_stringS = TEXT
teaser_stringS {
field = teaser
}
datetime_dateS = TEXT
datetime_dateS {
field = datetime
date = Y-m-d\TH:i:s\Z
}
content = SOLR_CONTENT
content {
cObject = COA
cObject {
10 = TEXT
10 {
field = bodytext
noTrimWrap = || |
}
20 = TEXT
20 {
field = tags_stringM
noTrimWrap = || |
}
}
}
categorytitle_stringS = SOLR_RELATION
categorytitle_stringS {
localField = categories
multiValue = 1
}
categoryuid_stringS = SOLR_RELATION
categoryuid_stringS {
localField = categories
foreignLabelField = uid
multiValue = 1
}
keywords = SOLR_MULTIVALUE
keywords {
field = keywords
}
tags_stringM = SOLR_RELATION
tags_stringM {
localField = tags
label = Tags
multiValue = 1
}
tagshr_stringM = SOLR_RELATION
tagshr_stringM {
localField = tags
label = Tags hr
foreignLabelField = title_hr
multiValue = 1
}
mediatypehr_intS = TEXT
mediatypehr_intS {
field = media_type_hr
}
mediatypede_intS = TEXT
mediatypede_intS {
field = media_type_de
}
image_stringS = FILES
image_stringS {
references {
table = tx_news_domain_model_news
uid.field = uid
fieldName = fal_media
}
begin = 0
maxItems = 1
renderObj = IMG_RESOURCE
renderObj {
file.import.data = file:current:publicUrl
file.maxW = 330
#wrap = |
}
}
url = CASE
url {
key.field = type
# Internal
1 = TEXT
1 {
if.isTrue.field = internalurl
typolink.parameter.field = internalurl
typolink.useCacheHash = 1
typolink.returnLast = url
}
# External
2 = TEXT
2 {
if.isTrue.field = externalurl
field = externalurl
}
default = TEXT
default {
typolink.parameter = {$plugin.tx_news.settings.detailPid}
typolink.additionalParams = &tx_news_pi1[controller]=News&tx_news_pi1[action]=detail&tx_news_pi1[news]={field:uid}&L={field:__solr_index_language}
typolink.additionalParams.insertData = 1
typolink.useCacheHash = 1
typolink.returnLast = url
}
}
}
attachments = 1
attachments {
fields = fal_related_files
fileExtensions = *
}
}
}
}
plugin.tx_solr.logging.indexing.queue.news = 1
Aside from defining the fields for indexing you also need to declare these fields as relevant for search. (and with a weight how important they are for searching)
One possible solution could be like in this part of typoscript:
plugin {
tx_solr {
search {
query {
queryFields := addToList(categorytitle_stringS^2.0,keywords2.0,tags_stringM^2.0, tagshr_stringM^2.0)
}
}
}
}
see manual

Change name of content type for faceting

I use the following TS from documentation (apache-solr-for-typo3) for a simple facet
plugin.tx_solr.search {
faceting = 1
faceting {
facets {
contentType {
label = Content Type
field = type
}
}
}
}
The result is e.g.
sys_file_metadata (691)
tt_address (341)
tx_news_domain_model_news (180)
pages (153)
tx_events2_domain_model_event (2)
How can I rename e.g. tt_address to Personen and the other titles for better readability?
Here is my configuration for tt_address
plugin.tx_solr.index.queue {
tt_address = 1
tt_address {
table = tt_address
lable = Personen
additionalWhereClause = first_name NOT LIKE ''
fields {
abstract = position
description = description
title = name
personen_stringS = Personen
content = SOLR_CONTENT
content {
field = title
}
url = TEXT
url {
typolink.parameter.field = detail
typolink.returnLast = url
typolink.useCacheHash = 0
}
}
}
}
TYPO3 10.4.18., solr 11.0.4
It's not at the queuing where you set the label.
plugin {
tx_solr {
search {
faceting = 1
faceting {
facets {
# contentType {
# label = Content Type
# field = type
# }
contentType {
label = Filter
field = type
renderingInstruction = CASE
renderingInstruction {
key.field = optionValue
pages = TEXT
pages.value = Internetseiten
tx_solr_file = TEXT
tx_solr_file.value = Dateien
tx_news_domain_model_news = TEXT
tx_news_domain_model_news.value = Nachrichten
tt_address = TEXT
tt_address.value = Adressen
}
}
:

Typolink to index Pages on solr

I setup a TYPO3 v.9 website with solr.
And for some reason, the Pages indexer not working. So I used the custom TS configuration bellow, to work around and to force Pages indexing. With this custom TS, pages was indexed, BUT the links to a Page from the "Search results" is not working.
This is my custom TS :
#TS added to force page indexing
plugin.tx_solr.index.queue {
snar_pages = 1
snar_pages {
table = pages
fields {
title = title
content = SOLR_CONTENT
content {
cObject = COA
cObject {
10 = TEXT
10 {
field = bodytext
noTrimWrap = || |
}
}
}
url = CASE
url {
key.field = type
# Internal
1 = TEXT
1 {
if.isTrue.field = internalurl
typolink.parameter.field = internalurl
typolink.useCacheHash = 1
typolink.returnLast = url
}
# External
2 = TEXT
2 {
if.isTrue.field = externalurl
field = externalurl
}
default = TEXT
default {
typolink.parameter = {link}
typolink.additionalParams >
typolink.useCacheHash = 1
typolink.returnLast = url
}
}
}
}
is there an error in my TS that prevents the links to the pages from working ?
hmm i think you missed something to setup too for indexing pages. The DataFrontendHelper
see the docs
edited:
plugin.tx_solr {
index {
queue {
pages {
indexer {
frontendDataHelper {
host = {$plugin.tx_solr.indexer.frontendDataHandler.host}
scheme = {$plugin.tx_solr.indexer.frontendDataHandler.scheme}
}
}
}
}
}
}
Changing my TS as follows, and this fixed my problem :
url = CASE
url {
key.field = doktype
default = TEXT
default {
field = title
typolink.parameter.field = uid
typolink.returnLast = url
}
PS : pages need to be re-indexed for good results.

TYPO3 Formhandler finisher does not write to database

After the TYPO3 (6.1.7) website of a customer has gone online, the Formhandler forms do not work correctly anymore. They do send an email, but it seems that they do not execute the Finisher_DB for writing into the database anymore.
The TypoScript settings look like this:
plugin.Tx_Formhandler.settings {
debug = 0
# GENERAL CONFIGURATION
name = Default
addErrorAnchors = 1
formValuesPrefix = formhandler
fillValueMarkersBeforeLangMarkers = 1
# ERRORS LAYOUT
singleErrorTemplate {
totalWrap = <div>|</div>
singleWrap = <span class="error">|</span><br />
}
errorListTemplate {
totalWrap = <ul>|</ul>
singleWrap = <li class="error">|</li>
}
validators {
1.class = Tx_Formhandler_Validator_Default
1.config {
fieldConf {
wish.errorCheck.1 = required
alternative.errorCheck.1 = required
firstname.errorCheck.1 = required
surname.errorCheck.1 = required
nationality.errorCheck.1 = required
dateofbirth.errorCheck.1 = required
phone.errorCheck.1 = required
email.errorCheck.1 = required
street.errorCheck.1 = required
zip.errorCheck.1 = required
city.errorCheck.1 = required
country.errorCheck.1 = required
}
}
}
# Finishers configuration
finishers {
1.class = Tx_Formhandler_Finisher_Mail
1.config {
checkBinaryCrLf = registrationMessagePlain, registrationMessageHtml
limitMailsToUser = 10
admin {
}
user {
}
}
2.class = Tx_Formhandler_Finisher_DB
2.config{
table = tx_chilifhregistration
key = uid
fields {
timeslot = Sommerplatz
timeslot_july.mapping = timeslotSummerJuly
timeslot_august.mapping = timeslotSummerAugust
timeslot_september.mapping = timeslotSummerSeptember
wish.mapping = wish
wishcategory11.mapping = wishCategory11
wishcategory19.mapping = wishCategory19
wishcategory22.mapping = wishCategory22
wishcategorydb.mapping = wishCategoryDb
alternative.mapping = alternative
alternativecategory11.mapping = alternativeCategory11
alternativecategory19.mapping = alternativeCategory19
alternativecategory22.mapping = alternativeCategory22
alternativecategorydb.mapping = alternativeCategoryDb
salutation.mapping = salutation
firstname.mapping = firstname
surname.mapping = surname
nationality.mapping = nationality
dateofbirth.mapping = dateofbirth
phone.mapping = phone
email.mapping = email
street.mapping = street
zip.mapping = zip
city.mapping = city
country.mapping = country
salutation2.mapping = salutation2
firstname2.mapping = firstname2
surname2.mapping = surname2
nationality2.mapping = nationality2
dateofbirth2.mapping = dateofbirth2
phone2.mapping = phone2
email2.mapping = email2
street2.mapping = street2
zip2.mapping = zip2
city2.mapping = city2
country2.mapping = country2
}
}
}
}
What could be the problem?
You should better use the predef-definition-style for forms. This will save you trouble with multiple forms and is a cleaner implementation.
plugin.Tx_Formhandler.settings.predef.yourformularname { ...config... }
You can find a bunch of examples on the offical site/examples
I assume that your admin and user mail-config is only empty because you won´t post any customerinformation?
Did the form work if you fill in every single field?
In my own usecases all field i map with the finisher are required, maybe you should set a ...IfEmpty-option for non-require fields.
Here are the available ifEmpty-options.

Resources