Skip to content

Commit 6498cd4

Browse files
authored
Similarity search field now accepts key:value filters that contain colon ":" in the value + fix bug on "Load More" when search filter is active (#221)
* Similarity search field now accepts key:value filters that contain a colon ":" in the value * Fixed "Load More" action when a search filter is active
1 parent 4e39b5b commit 6498cd4

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/components/Points/PointsTabs.jsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ const PointsTabs = ({ collectionName, client }) => {
2525
}
2626
setOffset(null);
2727
setConditions(conditions);
28-
if (conditions.length === 0) {
29-
setPoints({ points: [] });
30-
}
28+
setPoints({ points: [] });
3129
};
3230

3331
const deletePoint = (collectionName, pointIds) => {
@@ -98,15 +96,16 @@ const PointsTabs = ({ collectionName, client }) => {
9896
setErrorMessage(null);
9997
} else if (filters.length !== 0) {
10098
const newPoints = await qdrantClient.scroll(collectionName, {
99+
offset,
101100
filter: {
102101
must: filters,
103102
},
104-
limit: pageSize + (offset || 0),
103+
limit: pageSize,
105104
with_payload: true,
106105
with_vector: true,
107106
});
108107
setPoints({
109-
points: [...(newPoints?.points || [])],
108+
points: [...(points?.points || []), ...(newPoints?.points || [])],
110109
});
111110
setNextPageOffset(newPoints?.next_page_offset);
112111
setErrorMessage(null);

src/components/Points/SimilarSerachfield.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ function SimilarSerachfield({ conditions, onConditionChange, vectors, usingVecto
1111

1212
const handleAddChip = (chip) => {
1313
setErrorMessage(null);
14-
const keyValue = chip.split(':');
15-
if (keyValue.length !== 2) {
14+
const keyValue = chip.split(/:(.*)/);
15+
if (keyValue.length < 2 || !keyValue[0].trim()) {
1616
setErrorMessage('Invalid format of key:value pair');
1717
return;
1818
}
1919
const key = keyValue[0].trim();
20-
const parseToPrimitive = (keyValue) => {
20+
const parseToPrimitive = (value) => {
2121
try {
22-
return bigIntJSON.parse(keyValue[1].trim());
22+
return bigIntJSON.parse(value);
2323
} catch (e) {
24-
return keyValue[1].trim();
24+
return value;
2525
}
2626
};
27-
const value = parseToPrimitive(keyValue);
27+
const value = parseToPrimitive(keyValue[1].trim());
2828
if (key === 'id') {
2929
if (value && (typeof value === 'number' || typeof value === 'bigint' || validateUuid(value))) {
3030
const id = {

0 commit comments

Comments
 (0)