rgw: es: generic keys are not case sensitive

make map case insensitive, and explicitly define all generic keys
so that they can be forced to be lower case.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
This commit is contained in:
Yehuda Sadeh 2017-04-07 16:34:35 -07:00
parent 4a91a542e9
commit 2c9a7bc993
3 changed files with 10 additions and 4 deletions

View File

@ -34,7 +34,7 @@ int main(int argc, char *argv[])
ESQueryCompiler es_query(expr, nullptr, "x-amz-meta-");
map<string, string> aliases = { { "key", "name" },
map<string, string, ltstr_nocase> aliases = { { "key", "name" },
{ "etag", "meta.etag" },
{ "size", "meta.size" },
{ "mtime", "meta.mtime" },

View File

@ -1,6 +1,8 @@
#ifndef CEPH_RGW_ES_QUERY_H
#define CEPH_RGW_ES_QUERY_H
#include "rgw_string.h"
class ESQueryStack {
list<string> l;
list<string>::iterator iter;
@ -100,7 +102,7 @@ class ESQueryCompiler {
ESEntityTypeMap *generic_type_map{nullptr};
ESEntityTypeMap *custom_type_map{nullptr};
map<string, string> *field_aliases;
map<string, string, ltstr_nocase> *field_aliases;
set<string> *restricted_fields;
public:
@ -131,7 +133,7 @@ public:
return custom_type_map;
}
void set_field_aliases(map<string, string> *fa) {
void set_field_aliases(map<string, string, ltstr_nocase> *fa) {
field_aliases = fa;
}

View File

@ -162,7 +162,11 @@ void RGWMetadataSearchOp::execute()
ESQueryCompiler es_query(expression, &conds, custom_prefix);
static map<string, string> aliases = { { "key", "name" },
static map<string, string, ltstr_nocase> aliases = {
{ "bucket", "bucket" }, /* forces lowercase */
{ "name", "name" },
{ "key", "name" },
{ "instance", "instance" },
{ "etag", "meta.etag" },
{ "size", "meta.size" },
{ "mtime", "meta.mtime" },