Closed (fixed)
Project:
Search API Solr
Version:
8.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Nov 2019 at 14:28 UTC
Updated:
6 Mar 2020 at 15:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
b2f commentedUpdated supporting organization
Comment #3
sylvainm commented+1
Comment #4
mkalkbrennerThis patch will remove all special characters for French!
We wanted exactly the opposite to distinguish between the accents.
Could you describe the issue you have?
Comment #5
b2f commentedIndeed it could be useful that accents are removed so that when a user type the unaccented character in a fulltext input, it will give the same results regardless.
For instance on a website we are working on, if I'm searching "endometriose", I should find "endométriose" in the results. It seem to be a common need.
Cheers.
Comment #6
b2f commentedActually the client request is especially true for the opposite, when we type the "é" character in the fulltext search, we want to find the unaccented "e" in the results.
Comment #7
mkalkbrennerIt's impossible to define a configuration that fits all needs.
But the good thing is, that you can simply leverage drupal's config management to adjust the settings to your customer's requirement without a patch!
I suggest that you create your own "domain" and adjust the accents there. Have a look at the documentation:
https://www.drupal.org/docs/8/modules/search-api-solr/search-api-solr-ho...
Comment #8
b2f commentedThanks for the tip, I didn't know about that feature.
Comment #9
DeFr commentedSorry for re-opening this, but please read the following. While I'm pretty sure everyone agree that providing a single config that will work for all French users isn't possible, I still think that there's a few stuff that can be tweaked to better fit the needs of the majority of the french users out there.
Note : everything below is specific to French ; it's the only language for which I've actually investigated what the various stemmers algorithm provided by Solr do, and it's the only one I can claim I've implemented on a lot of sites targeted toward different audience. Some might apply to other language too, but I can't guarantee it.
First of all, I'm kinda surprised about the statement in #4 , "We wanted exactly the opposite to distinguish between the accents." . Do you have some links to public discussion about that ? Because (spoiler alert), that's not what's going on with the current configuration, more on that later.
As is, the configuration shipped for the french language feelds weird :
All of this being said, I'm not completely sure what the best way forward is. A few options I can think of
- If we assume that end users pretty much never input accents correctly, then @B2F patch above makes sense : it means that there's a few stemming case in Snowball Porter that won't be it, but it'll be consistent between the query and indexing, and thus make end users find what they're looking for, correctly written or not
- Another approach would be to switch to FrenchLightStemFilterFactory
At the very least, I think accents_fr should be made consistent.
Comment #10
mkalkbrennerObviously languages are different ;-)
In German it is a big mistake to transliterate an Umlaut. Examples:
Küchen => kitchens
Kuchen => cake
Ich fahre mit der Fähre. => I "take" the ferry.
I don't know if there're similar examples for French or not.
The discussions about the default configurations for several languages happened at different Drupal Cons with people from different countries.
And I always encourage people to contribute their configs.
So I'll accept a patch to change the French default field type. But the patch has to be complete including the upgrade path.
Comment #11
mkalkbrennerI can at least help with the update.
Comment #12
b2f commentedHello Markus,
How should I go about making a better patch ? Thanks.
Comment #13
mkalkbrennerFor existing installations the new configs don't get magically applied.
You need to implement an update hook. Have a look at
search_api_solr_update_8311().Comment #14
b2f commentedComment #15
gonssalI just wanted to chim in to say that in both Spanish and Catalan, by default it should also be expected to transliterate all the accents. Except in some very rare cases, there's no change of meaning for the same word with accent (tilde) and without it and, even in those cases, it would generally be fine to get all the results.
I'm not a french speaker but I think in the provided patch, the
Ç => Candç => cconversions should be left commented. For example plaçage is not the same as placage. This is indeed complex stuff.Also I don't think the tweaked configs should be automatically applied on existing installations, just changed when a new config.zip is generated and the tweaks documented in the release notes, so people don't get sudden unexpected behaviour changes. In other words, I don't think an upgrade path should be included.
Comment #16
mkalkbrennerGondel, please Open a dedicated issue.
Fun fact, the current config has been developed in Barcelona at DrupalCon. But maybe some didn’t understand the “nature” of search and followed the German reference too strictly.
Comment #17
gonssal@mkalkbrenner I will open a new issue, but will it be ok if there's no upgrade path as I suggested? I don't think automatically upgrading configs without user action is a good idea.
Comment #18
b2f commentedI think the update is indeed questionable, the provided example above in search_api_solr_update_8311 is adding new values not replacing existing ones.
Comment #19
mkalkbrennerOK, I agree on your suggestion to skip the upgrade path. But the patch should be extended by comments added to the yml files why these characters are normalized. maybe including a link to this issue.
Comment #20
mkalkbrennerComment #22
mkalkbrennerComment #23
b2f commented