def es_query_with_analyzer(query, locale):
 analyzer = es_analyzer_for_locale(locale, synonyms=True)
 new_query = {}
 from kitsune.search.models import get_mapping_types
 localized_fields = []
 for mt in get_mapping_types():
  localized_fields.extend(mt.get_localized_fields())
 for (k, v) in query.items():
  (field, action) = k.split('__')
  if (field in localized_fields):
   new_query[(k + '_analyzer')] = (v, analyzer)
  else:
   new_query[k] = v
 return new_query

def es_query_with_analyzer ( query , locale ) : analyzer = es_analyzer_for_locale ( locale , synonyms = True ) new_query = { } from kitsune . search . models import get_mapping_types localized_fields = [ ] for mt in get_mapping_types ( ) : localized_fields . extend ( mt . get_localized_fields ( ) ) for ( k , v ) in query . items ( ) : ( field , action ) = k . split ( '__' ) if ( field in localized_fields ) : new_query [ ( k + '_analyzer' ) ] = ( v , analyzer ) else : new_query [ k ] = v return new_query
transform a query dict to use _analyzer actions for the right fields .