02-21-2021 05:45 AM
Just to share experience with (future) Alfresco user in googling for
TROUBLE with LOCALE and SEARCH query in MULTIPLE LANGUAGES … and how to fix it 🙂
In my shop we are using devices with different locale(s) ( en / it )
I noticed I could have a search performed from a browser in a certain locale (en_US), but I could NOT have the same search performed with other devices/browsers with other locale (it_IT)
If you have the same problem, and are using ubuntu + ACS 6,2, maybe this could help you...
Thanks to anyone who gave me some precious hint to dig into in https://hub.alfresco.com/t5/alfresco-content-services-forum/solr-search-result-changes-depending-on-...
will show the configured (if any) locale environment variables ... IF the is no configuration, you should run
sudo locale-gen "$YOURLOCALESUPPORT"
sudo update-locale LANG="$YOURLOCALESUPPORT"
More info on https://help.ubuntu.com/community/Locale#List_current_settings and https://www.thomas-krenn.com/en/wiki/Configure_Locales_in_Ubuntu
eg:
JAVA_OPTS="$JAVA_OPTS $LOGGING_MANAGER -Duser.language=en -Duser.region=US"
It is advised NOT to directly change catalina.sh and set the (any) variables in this script. Instead put them into a script file named setenv.sh in CATALINA_BASE/bin to keep your customizations separate. The setenvh.sh will be automatically sourced (loaded) into catalina.sh at runtime.
I tried removing the Tomcat customization (setenv.sh) and the multisearch query works the same. Maybe the information may help if you have other locale related problems
2- Install Afresco Repository (ACS) as usual (I’m using the wonderful ansible-alfresco github install script from @jpotts !)
3 – Install Afresco Search services files, but do NOT run the index command yet (i.e. do NOT run ./solr/bin/solr start -a "-Dcreate.alfresco.defaults=alfresco,archive" )
as suggested by @arjunmony, modify the TWO following Solr6 config files, as reported in
https://docs.alfresco.com/search-community/concepts/solr-shared-properties.html
Important: you should modify BOTH files. (the official Alfresco doc should better clarify that you need to modify both files...)
To have Solr index the various datatype for multiple languages (locales) , modify (uncomment) the first file
/opt/alfresco/alfresco-search-services/solrhome/conf/shared.properties
# Data types that support cross locale/word splitting/token patterns if tokenised
alfresco.cross.locale.datatype.0={http://www.alfresco.org/model/dictionary/1.0}text
alfresco.cross.locale.datatype.1={http://www.alfresco.org/model/dictionary/1.0}content
alfresco.cross.locale.datatype.2={http://www.alfresco.org/model/dictionary/1.0}mltext
NB: you need to change alfresco.cross.locale.datatype, NOT the alfresco.cross.locale.property.
Lines
Then , to let Solr correctly detect&apply the used locale of the browser, modify the second file
alfresco-search-services/solrhome/templates/rerank/conf/solrconfig.xml
<queryParser name="afts" class="org.alfresco.solr.query.AlfrescoFTSQParserPlugin">
<str name="rerankPhase">QUERY_PHASE</str>
<str name="autoDetectQueryLocale ">true</str>
<str name="autoDetectQueryLocales ">en,it</str>
</queryParser>
4- Now you can safely run
./solr/bin/solr start -a "-Dcreate.alfresco.defaults=alfresco,archive"
to create the two Solr6 cores (alfresco & archive)
If you want update/change again the alfresco.cross.locale.datatype.x
in /opt/alfresco/alfresco-search-services/solrhome/conf/shared.properties ,
please consider that you will have to delete an recreate again the indexes , as reported in
https://github.com/keensoft/alf-21940-repo
5- test you browsers with different locales.
If using chrome you can change the default locale typing the address
chrome://settings/languages
and modify it as wanted.
I firefox you will find the locale settings in Preferences->General->Languages
02-22-2021 07:21 AM
Using autoDetectQueryLocale and autoDetectQueryLocales should be completely unnecessary if you set cross locale datatypes in shared.properties. In all the time since I originally gave the talk on Important Workaround for making ASS muli-lingual I have never found any case where those would be relevant at all.
Explore our Alfresco products with the links below. Use labels to filter content by product module.