def construct_query_part(model_cls, prefixes, query_part):
 if (not query_part):
  return query.TrueQuery()
 query_classes = {}
 for (k, t) in itertools.chain(model_cls._fields.items(), model_cls._types.items()):
  query_classes[k] = t.query
 (key, pattern, query_class) = parse_query_part(query_part, query_classes, prefixes)
 if (key is None):
  if issubclass(query_class, query.FieldQuery):
   return query.AnyFieldQuery(pattern, model_cls._search_fields, query_class)
  else:
   return query_class(pattern)
 key = key.lower()
 return query_class(key.lower(), pattern, (key in model_cls._fields))

def construct_query_part ( model_cls , prefixes , query_part ) : if ( not query_part ) : return query . TrueQuery ( ) query_classes = { } for ( k , t ) in itertools . chain ( model_cls . _fields . items ( ) , model_cls . _types . items ( ) ) : query_classes [ k ] = t . query ( key , pattern , query_class ) = parse_query_part ( query_part , query_classes , prefixes ) if ( key is None ) : if issubclass ( query_class , query . FieldQuery ) : return query . AnyFieldQuery ( pattern , model_cls . _search_fields , query_class ) else : return query_class ( pattern ) key = key . lower ( ) return query_class ( key . lower ( ) , pattern , ( key in model_cls . _fields ) )
create a query from a single query component .