mirror of
https://github.com/nasa/openmct.git
synced 2025-05-11 04:52:57 +00:00
Fix partial matches (#8047) Support character escaping
This commit is contained in:
parent
9c9329d8b1
commit
fffee68e9c
@ -466,21 +466,27 @@ class CouchObjectProvider {
|
|||||||
let stringifiedKeys = JSON.stringify(keysToSearch);
|
let stringifiedKeys = JSON.stringify(keysToSearch);
|
||||||
const url = `${this.url}/_design/${designDoc}/_view/${viewName}`;
|
const url = `${this.url}/_design/${designDoc}/_view/${viewName}`;
|
||||||
const requestBody = {};
|
const requestBody = {};
|
||||||
|
let requestBodyString;
|
||||||
|
|
||||||
if (objectIdField === undefined) {
|
if (objectIdField === undefined) {
|
||||||
requestBody.include_docs = true;
|
requestBody.include_docs = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (limit !== undefined) {
|
||||||
|
requestBody.limit = limit;
|
||||||
|
}
|
||||||
|
|
||||||
if (startKey !== undefined && endKey !== undefined) {
|
if (startKey !== undefined && endKey !== undefined) {
|
||||||
/* spell-checker: disable */
|
/* spell-checker: disable */
|
||||||
requestBody.startkey = startKey;
|
requestBody.startkey = startKey;
|
||||||
requestBody.endkey = endKey;
|
requestBody.endkey = endKey;
|
||||||
|
requestBodyString = JSON.stringify(requestBody);
|
||||||
|
requestBodyString = requestBodyString.replace('$START_KEY', startKey);
|
||||||
|
requestBodyString = requestBodyString.replace('$END_KEY', endKey);
|
||||||
/* spell-checker: enable */
|
/* spell-checker: enable */
|
||||||
} else {
|
} else {
|
||||||
requestBody.keys = stringifiedKeys;
|
requestBody.keys = stringifiedKeys;
|
||||||
}
|
requestBodyString = JSON.stringify(requestBody);
|
||||||
|
|
||||||
if (limit !== undefined) {
|
|
||||||
requestBody.limit = limit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let objectModels = [];
|
let objectModels = [];
|
||||||
@ -490,7 +496,7 @@ class CouchObjectProvider {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
signal: abortSignal,
|
signal: abortSignal,
|
||||||
body: JSON.stringify(requestBody)
|
body: requestBodyString
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
@ -94,7 +94,7 @@ class CouchSearchProvider {
|
|||||||
designDoc: 'object_names',
|
designDoc: 'object_names',
|
||||||
viewName: 'object_names',
|
viewName: 'object_names',
|
||||||
startKey: preparedQuery,
|
startKey: preparedQuery,
|
||||||
endKey: preparedQuery + '\\ufff0',
|
endKey: preparedQuery + `\ufff0`,
|
||||||
objectIdField: 'value',
|
objectIdField: 'value',
|
||||||
limit: 1000
|
limit: 1000
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user