Skip to content

Commit 54f9e8c

Browse files
authored
Quality check timeout (#228)
* rename SearchQualityPannel -> SearchQualityPanel, added timeout as param * fixes
1 parent a077ffa commit 54f9e8c

File tree

5 files changed

+23
-15
lines changed

5 files changed

+23
-15
lines changed

src/components/Collections/SearchQuality/SearchQuality.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useEffect } from 'react';
22
import PropTypes from 'prop-types';
33
import { getSnackbarOptions } from '../../Common/utils/snackbarOptions';
44
import { useClient } from '../../../context/client-context';
5-
import SearchQualityPannel from './SearchQualityPannel';
5+
import SearchQualityPanel from './SearchQualityPanel';
66
import { useSnackbar } from 'notistack';
77
import { Box, Card, CardHeader } from '@mui/material';
88
import { CopyButton } from '../../Common/CopyButton';
@@ -51,7 +51,7 @@ const SearchQuality = ({ collectionName }) => {
5151
return (
5252
<>
5353
{collection?.config?.params?.vectors && (
54-
<SearchQualityPannel
54+
<SearchQualityPanel
5555
collectionName={collectionName}
5656
vectors={vectors}
5757
loggingFoo={handleLogUpdate}

src/components/Collections/SearchQuality/SearchQualityPannel.jsx renamed to src/components/Collections/SearchQuality/SearchQualityPanel.jsx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ VectorTableRow.propTypes = {
7373
isInProgress: PropTypes.bool,
7474
};
7575

76-
const SearchQualityPannel = ({ collectionName, vectors, loggingFoo, clearLogsFoo, ...other }) => {
76+
const SearchQualityPanel = ({ collectionName, vectors, loggingFoo, clearLogsFoo, ...other }) => {
7777
const { client } = useClient();
7878
const vectorsNames = Object.keys(vectors);
7979
const [precision, setPrecision] = useState(() => {
@@ -110,7 +110,8 @@ const SearchQualityPannel = ({ collectionName, vectors, loggingFoo, clearLogsFoo
110110
// "value": "field_value"
111111
// }
112112
// }
113-
// }
113+
// },
114+
// "timeout": 20
114115
// }
115116
116117
`);
@@ -153,14 +154,21 @@ const SearchQualityPannel = ({ collectionName, vectors, loggingFoo, clearLogsFoo
153154
},
154155
],
155156
},
157+
timeout: {
158+
description: 'Timeout for search',
159+
type: 'integer',
160+
format: 'uint',
161+
minimum: 1,
162+
nullable: true,
163+
},
156164
},
157165
});
158166

159167
if (!vectors) {
160168
return <>No vectors</>;
161169
}
162170

163-
const onCheckIndexQuality = async ({ using = '', limit = 10, params = null, filter = null }) => {
171+
const onCheckIndexQuality = async ({ using = '', limit = 10, params = null, filter = null, timeout }) => {
164172
setInProgress(true);
165173

166174
clearLogsFoo && clearLogsFoo();
@@ -191,7 +199,8 @@ const SearchQualityPannel = ({ collectionName, vectors, loggingFoo, clearLogsFoo
191199
filter,
192200
params,
193201
using,
194-
limit
202+
limit,
203+
timeout
195204
);
196205
if (precision) {
197206
precisions.push(precision);
@@ -311,12 +320,12 @@ const SearchQualityPannel = ({ collectionName, vectors, loggingFoo, clearLogsFoo
311320
);
312321
};
313322

314-
SearchQualityPannel.propTypes = {
323+
SearchQualityPanel.propTypes = {
315324
collectionName: PropTypes.string,
316325
vectors: PropTypes.object.isRequired,
317326
loggingFoo: PropTypes.func,
318327
clearLogsFoo: PropTypes.func,
319328
other: PropTypes.object,
320329
};
321330

322-
export default SearchQualityPannel;
331+
export default SearchQualityPanel;

src/components/Collections/SearchQuality/check-index-precision.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ export const checkIndexPrecision = async (
88
filter = null,
99
params = null,
1010
vectorName = null,
11-
limit = 10
11+
limit = 10,
12+
timeout = 20
1213
) => {
13-
const TIMEOUT = 20;
14-
1514
try {
1615
const exactSearchtartTime = new Date().getTime();
1716

@@ -25,15 +24,15 @@ export const checkIndexPrecision = async (
2524
},
2625
filter: filter,
2726
using: vectorName,
28-
timeout: TIMEOUT,
27+
timeout,
2928
});
3029

3130
const exactSearchElapsed = new Date().getTime() - exactSearchtartTime;
3231

3332
const searchStartTime = new Date().getTime();
3433

3534
const hnsw = await client.query(collectionName, {
36-
timeout: TIMEOUT,
35+
timeout,
3736
limit: limit,
3837
with_payload: false,
3938
with_vectors: false,

src/components/EditorCommon/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const EditorCommon = ({ beforeMount, customHeight, ...props }) => {
7373
EditorCommon.propTypes = {
7474
height: PropTypes.string,
7575
beforeMount: PropTypes.func,
76-
customHeight: PropTypes.number,
76+
customHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
7777
...Editor.propTypes,
7878
};
7979

src/components/FilterEditorWindow/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,6 @@ CodeEditorWindow.propTypes = {
118118
code: PropTypes.string.isRequired,
119119
onChangeResult: PropTypes.func.isRequired,
120120
customRequestSchema: PropTypes.func.isRequired,
121-
customHeight: PropTypes.number,
121+
customHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
122122
};
123123
export default CodeEditorWindow;

0 commit comments

Comments
 (0)