Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 22 additions & 13 deletions tests/unit/array/mixins/test_find.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,19 +257,26 @@ def test_find_by_tag(storage, config, start_storage):
)
for operator in ['gte', 'gt', 'lte', 'lt']
],
*[
tuple(
[
'qdrant',
lambda operator, threshold: {
'must': [{'key': 'price', 'value': {operator: threshold}}]
},
numeric_operators_qdrant,
operator,
]
)
for operator in ['eq', 'neq']
],
tuple(
[
'qdrant',
lambda operator, threshold: {
'must': [{'key': 'price', 'match': {'value': threshold}}]
},
numeric_operators_qdrant,
'eq',
]
),
tuple(
[
'qdrant',
lambda operator, threshold: {
'must_not': [{'key': 'price', 'match': {'value': threshold}}]
},
numeric_operators_qdrant,
'neq',
]
),
*[
tuple(
[
Expand Down Expand Up @@ -305,6 +312,8 @@ def test_search_pre_filtering(

results = da.find(np.random.rand(n_dim), filter=filter)

assert len(results) > 0

assert all(
[numeric_operators[operator](r.tags['price'], threshold) for r in results]
)
Expand Down
35 changes: 22 additions & 13 deletions tests/unit/array/mixins/test_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,19 +639,26 @@ def test_match_ensure_scores_unique():
)
for operator in ['gte', 'gt', 'lte', 'lt']
],
*[
tuple(
[
'qdrant',
lambda operator, threshold: {
'must': [{'key': 'price', 'value': {operator: threshold}}]
},
numeric_operators_qdrant,
operator,
]
)
for operator in ['eq', 'neq']
],
tuple(
[
'qdrant',
lambda operator, threshold: {
'must': [{'key': 'price', 'match': {'value': threshold}}]
},
numeric_operators_qdrant,
'eq',
]
),
tuple(
[
'qdrant',
lambda operator, threshold: {
'must_not': [{'key': 'price', 'match': {'value': threshold}}]
},
numeric_operators_qdrant,
'neq',
]
),
*[
tuple(
[
Expand Down Expand Up @@ -688,6 +695,8 @@ def test_match_pre_filtering(
doc = Document(embedding=np.random.rand(n_dim))
doc.match(da, filter=filter)

assert len(doc.matches) > 0

assert all(
[
numeric_operators[operator](r.tags['price'], threshold)
Expand Down