Closed (duplicate)
Project:
Search API
Version:
8.x-1.x-dev
Component:
General code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
10 Feb 2018 at 00:16 UTC
Updated:
20 Apr 2019 at 19:56 UTC
Jump to comment: Most recent
Comments
Comment #2
geek-merlinAah, this D7 module does the job while indexing:
https://cgit.drupalcode.org/apachesolr_language_fallback/tree/apachesolr...
Comment #3
mkalkbrennerInteresing idea. But I wonder if the implementation should really depend on the language_hierarchy module. There's no activity for more than a year.
BTW we already have soemething in place for locales: "de-AT" falls back to "de".
Comment #4
geek-merlin> But I wonder if the implementation should really depend on the language_hierarchy module.
Hi Markus, that's a misunderstanding. In fact
> of the core language fallback system,
this is the core hook
> for which Language Hierarchy is a GUI.
and this is just an example for convenience how to play with it.
Comment #5
geek-merlinComment #6
mkalkbrennerDo you know of any integration with Views using such language fallbacks?
Anyway, we can add something to our module.
Can you describe some concrete examples as a guideline for implementing it?
Comment #7
neoxavier commentedjust an idea, we have similar use case in our solution. We did the fallback check on query.
Comment #8
mkalkbrennerComment #9
mkalkbrennerI think that this should be solved by Search API itself and not the backend.
The simple approach would be to contain the targeted AND the fallback language in the Search API Query. The fallback language(s) should be added automatically if requested.
Comment #10
drunken monkeyIn what way would that be different from #1960684: Allow filtering by "Language (with fallback)" or the (WIP) patch proposed there?
(Having this processor directly in Search API instead of the CLIR module would of course be an option either way.)
Comment #11
geek-merlinHussa!
entity_language_fallback contains a processor that does the work on indexing. I like that approach as it allows fallback sequences that vary by entity.
https://cgit.drupalcode.org/entity_language_fallback/tree/src/Plugin/sea...
What i did not grok instantly is why they need a different datasource:
https://cgit.drupalcode.org/entity_language_fallback/tree/src/Plugin/sea...
EDIT: From readme:
Comment #12
drunken monkeyGreat to hear, thanks for sharing!
Maybe ping them about adding the “Search API” ecosystem to the project description so it will be listed in our ecosystem.
Comment #13
geek-merlinHmm, i'd also like to explore where this should be going. While the processor works (i tested it), my gut feeling is that this should some day live in search_api's entity processor. What do you mean? See links to the source above.
Comment #14
drunken monkeyHm, not sure whether that’s the best approach. If I understand this correctly (didn’t try it out) this will, e.g., when indexing an English node also index a copy of that node as French if there is no French translation (depending on the fallback settings, of course)?
Then apart from bloating the index unnecessarily, it also seems this would mean that Solr would try to do French text preprocessing on the English text content of that node on indexing, right? Needless to say, this wouldn’t work properly.
I also don’t see a big market for varying fallback sequences by entity, but even so, it seems that could equally well be accomplished by switching the current
missing_translationsproperty for afallback_for_languagesproperty that will be filtered for as a fallback forsearch_api_languageat search time (please shout if I’m not making any sense here). However, while this would be more flexible, the downside would be that you’d then have to search all languages at search time and just let that filter do the filtering – decreasing performance, as long as there’s more than a couple of languages.All in all, I still think our approach in the CLIR issue is the better one. People who want the other one can just use the
entity_language_fallbackmodule right now, nothing preventing you from doing that. (You can probably just search/replace the datasource ID in the exported index config and re-import, that should give you the exact same index just with the added language fallback functionality.)Comment #15
geek-merlinOK thanks for thinking about this. No objections to proceed like this.
Comment #16
geek-merlinNow a dup of #1960684: Allow filtering by "Language (with fallback)".