openfoodfacts / search-a-licious

🍊🔎 A pluggable search service for large collections of objects (like Open Food Facts)
https://search.openfoodfacts.org
GNU Affero General Public License v3.0
6 stars 4 forks source link

Facet values linked to taxonomies should be translated using the taxonomy #120

Closed alexgarel closed 4 weeks ago

alexgarel commented 1 month ago

What

alexgarel commented 1 month ago

I see two way to do that:

  1. simply keep a dict in memory that maps values to translation in the different languages
  2. use a key value database like leveldb or equivalent and update it on each taxonomy changes

First option might be memory consuming, and could take time to start-up. Second option is nearly as fast, more efficient in memory and do not consume time at startup, but adds a dependency.

I considered the option to generate po files when we import taxonomies and use Babel to translate, but Babel is not memory efficient at all !

alexgarel commented 1 month ago

Finally there is even simpler: using ES in one query to get all translated values.