Skip to content

Commit da0829f

Browse files
authored
[BTS-2149] Improve performance of graph settings query (#21794)
1 parent ac9a528 commit da0829f

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
devel
22
-----
33

4+
* Improved performance of document-search query in graph settings UI (BTS-2149)
5+
46
* Upgraded bundled version of RocksDB to 9.5.
57

68
The default values for the following RocksDB-related startup options were

js/apps/system/_admin/aardvark/APP/react/src/views/graphV2/viewGraph/graphSettings/useNodeStartOptions.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,28 @@ const fetchOptions = async ({
1919
values: OptionType[];
2020
}) => {
2121
const inputSplit = inputValue.split("/");
22-
const [collectionName] = inputSplit;
2322
const db = getCurrentDB();
2423
if (inputSplit.length === 1) {
2524
// filter here
2625
const finalOptions = inputValue
2726
? collectionOptions?.filter(option =>
28-
option.value.includes(inputValue)
29-
) || []
27+
option.value.includes(inputValue)
28+
) || []
3029
: collectionOptions || [];
3130
return Promise.resolve(finalOptions);
3231
}
33-
const valuesList = values.map(value => value.value);
32+
const [collectionName, documentKey] = inputSplit;
33+
const valuesList = values
34+
.map(value => value.value.split("/"))
35+
.filter(valueSplit => valueSplit.length > 1 && valueSplit[0] === collectionName)
36+
.map(valueSplit => valueSplit[1]);
3437
const colQuery = aql`
3538
FOR doc IN ${db.collection(collectionName)}
36-
FILTER doc._id >= ${inputValue} && STARTS_WITH(doc._id, ${inputValue})
37-
FILTER doc._id NOT IN ${valuesList}
39+
FILTER doc._key >= ${documentKey}
40+
FILTER doc._key NOT IN ${valuesList}
41+
SORT doc._key
3842
LIMIT 5
43+
FILTER STARTS_WITH(doc._key, ${documentKey})
3944
RETURN doc._id`;
4045

4146
const cursor = await db.query(colQuery);

0 commit comments

Comments
 (0)