Le 28 nov. 2012 à 16:52, Eduard Moraru a écrit :
"title:something AND doccontent:somethingElse AND
lang:en" becomes
"(doccontent_en:something OR doccontent_fr:something OR ...) AND
(title_en:something OR title_fr:something OR ...) AND lang:en" (based on
the currently supported -- or just indexed -- languages)
Just a methodological note: we should not be programming queries by combining strings but
by combining Solr query objects which are rich, flexible, and easy to manipulate.
However, speaking this way in mails is by far the best way!
The mechanism you describe above is exactly how I would do it: my query expansion start
with a q parameter and a context.
Based on the context a weighted list of languages is extracted (context.language, then
browser languages).
I give the q parameter to the query-parser, with a whitespace analyzer. I obtain generally
a boolean-query (otherwise I wrap it). Then I recursively go through the components of the
boolean-queries.
Each TermQuery of the default field is expanded into a disjunction of the TermQuery in
each of the language (with their weight and with the right analyzer).
Same for each phrasequery, wildcardquery, and fuzzyquery (not sure).
Finding the analyzer defined in the Solr schema is not too hard.
I can share code if you wish.
Paul