Is it possible to hide a facet based on the current table ?
Exemple, I have a "news" table and a table "project".
But if I do this :
facets.state {
label.data = LLL:EXT:skin/Resources/Private/Language/locallang.xlf:search.rfp_state
field = state_intS
renderingInstruction = TEXT
renderingInstruction {
field = optionValue
wrap = {LLL:EXT:projects/Resources/Private/Language/locallang_db.xlf:tx_projects_domain_model_requestforprojects.state.items.|}
insertData = 1
}
includeInAvailableFacets = 0
}
The includeInAvailableFacets is
for both my news and project
Looked into the docs, but couldn't find what i've been looking for...
https://docs.typo3.org/p/apache-solr-for-typo3/solr/master/en-us/Configuration/Reference/TxSolrSearch.html#faceting-facets-facetname-includeinavailablefacets
Got it !
You have to declare condition to your precise page like this :
Where 1772 is your page id. Found a lead here : https://docs.typo3.org/m/typo3/reference-typoscript/8.7/en-us/Conditions/Reference/
[globalVar = TSFE:id =1772] && [globalVar = TSFE:id = {$plugin.tx_anrskin.settings.pages.solrSortDateDesc}] && [globalVar = GP:q =]
plugin.tx_solr.search.query.sortBy = sortDate_dateS desc
plugin.tx_solr.search.sorting = 0
plugin.tx_solr.search.query.returnFields = *, score
plugin.tx_solr.search.faceting.facets.dateinterval.includeInAvailableFacets = 0
plugin.tx_solr.search.faceting.facets.item.includeInAvailableFacets = 0
plugin.tx_solr.search.faceting.facets.name.includeInAvailableFacets = 0
[globalVar]
Related
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 = *
}
}
}
}
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
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 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?
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.