Typo3 solr facets formed by multiple values - solr

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 = *
}
}
}
}

Related

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

TYPO3 10 and Solr Extension - Search for partial Title not working

I am new to the Solr topic.
TYPO3 10.4.26
Solr-Ext 11.2.0
solr-spec 8.11.1
I have the following problem:
There is a file search by title, here it searches for "forklift" as an example. Solr then also finds files whose title contains "forklift" but not "forklifttest". Only if there is the whole word. It would be good if it is possible to search for "fork" and get "forklift" results.
How can I influence this? Maybe someone can help me.
Here you can see my index.queue settings for downloads. (Without additionalWhere because I do not think this will cause the problem)
I also tried _textNgramS = title but it doesn't seem to work
downloads = 1
downloads {
indexingPriority = 160
table = sys_file_metadata
additionalPageIds = 1,0
fields {
title = title
tabgroup_stringS = TEXT
tabgroup_stringS.value = downloads
size_intS = SOLR_RELATION
size_intS {
localField = file
foreignLabelField = size
}
fileExtension = SOLR_RELATION
fileExtension {
localField = file
foreignLabelField = extension
}
title_textS = SOLR_RELATION
title_textS {
localField = file
foreignLabelField = name
}
url_stringS = SOLR_RELATION
url_stringS {
localField = file
foreignLabelField = identifier
}
storageUid_intS = SOLR_RELATION
storageUid_intS {
localField = file
foreignLabelField = storage.uid
}
storage_stringS = SOLR_RELATION
storage_stringS {
localField = file
foreignLabelField = storage
}
category_stringM = SOLR_RELATION
category_stringM {
localField = categories
removeEmptyValues = 1
multiValue = 1
}
description = description
keywords = keywords
author = creator
}
}
I didn't make any changes to solr schema.xml or other solr stuff and hope i don't have to :D
If you need further informations let me know.

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
}
}
:

TYPO3 Solr: How to add additional fields to indexer?

[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?

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.

Resources