python - How to store search results for localization -
i have search results similar follows:
search.get_res() { "title": "the lion king", "synopsis": "when evil scar kills mufasa..." "runtime": 92 }
however, need localize title
, synopsis
if user using different language. in other words, need able specify like:
search.get_res(language="en") search.get_res(language="fr") search.get_res(language="de")
what best way store this? should in 1 json object? perhaps like:
{ "default": { "title": "the lion king", "synopsis": "when evil scar kills mufasa..." "runtime": 92 }, "fr": { "title": "le grande lion", "synopsis": "quande elle..." } }
or, best way store solr search result (not all, some) of information localized , localized in 50 languages. 50 synopses quite large if stored in same json object...
i assuming want search , display results in multiple languages. if thats case, there 2 strategies
- multi core configuration. each language has own core, , on application side, specify core search, based on language user has selected.
- single core configuration, duplicate fields each language - more or less same solution thinking of.
i found 2 websites go details of above configurations. http://www.basistech.com/indexing-strategies-for-multilingual-search-with-solr-and-rosette/ http://pavelbogomolenko.github.io/multi-language-handling-in-solr.html
in case want option of displaying results in different languages keep search limited english, solution might simpler. example doc
{ "doc1": { "en_title": "the lion king", "en_synopsis": "when evil scar kills mufasa..." "fr_title": "le grande lion", "fr_synopsis": "quande elle..." } }
in solr search specify return fields as
&fl=fr_*
(for french) or
&fl=en_*
(for english)
Comments
Post a Comment