use case insensitive search.

This commit is contained in:
Yoshihiro OKUMURA
2019-07-12 14:25:55 +09:00
parent c34f2921d9
commit 462f4e560c
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -81,9 +81,9 @@ class AdvancedSearchQuery {
// };
// filter2.push({ file: { '$elemMatch': filter3 } });
filter2.push({ 'file.file_type_name': fileType });
filter2.push({ ['file.' + subKey]: { '$regex': regex } });
filter2.push({ ['file.' + subKey]: { '$regex': [regex, 'i'] } });
} else {
filter2.push({ [key]: { '$regex': regex } });
filter2.push({ [key]: { '$regex': [regex, 'i'] } });
}
});
filter.push({ '$and': filter2 });
+3 -3
View File
@@ -556,7 +556,7 @@ class ItemUtil {
let nKeys: string[] = basicNumKeys.concat(numKeys);
sKeys.forEach((key) => {
let criteria: any = {};
criteria[key] = { '$regex': regex };
criteria[key] = { '$regex': [regex, 'i'] };
filterItemType['$or'].push(criteria);
});
if (num !== null) {
@@ -569,8 +569,8 @@ class ItemUtil {
filter['$or'].push(filterItemType);
}
if (type === 'basic') {
filter['$or'].push({ 'title': { '$regex': regex } });
filter['$or'].push({ 'keyword': { '$regex': regex } });
filter['$or'].push({ 'title': { '$regex': [regex, 'i'] } });
filter['$or'].push({ 'keyword': { '$regex': [regex, 'i'] } });
} else {
if (type === 'all' || type === 'binder') {
const strKeys: string[] = ['doi', 'title', 'keyword', 'description'];