Files
qdrant/openapi/tests/openapi_integration/test_count.py
Ibrahim M. Akrab f85ae02ab6 add isNull condition for payload filtering (#1617)
* add minimal working is_null filter

* add is_null condition to grpc api (backward compatible)

* add unit tests is_null and is_empty conditions

* add is_null to  points.proto file

* add some failing OpenAPI tests

* fix a failing test due to change in collection data

* refactor MultiValue's check for is_null

* fix is_empty condition not picking up "key":[]

* remove duplicate OpenAPI integration test

* reuse same variable in condition checker tests

* update grpc docs

* fix is_null cardinality estimation to match is_empty

* update openapi specs

* remove unused debug statements

* add new test points to original test_collection

* fix failing tests according to newly added points

* add the `"key":[null]` test_case
2023-04-01 20:46:50 +02:00

72 lines
2.0 KiB
Python

import pytest
from .helpers.collection_setup import basic_collection_setup, drop_collection
from .helpers.helpers import request_with_validation
collection_name = 'test_collection_threshold'
@pytest.fixture(autouse=True)
def setup():
basic_collection_setup(collection_name=collection_name)
yield
drop_collection(collection_name=collection_name)
def test_exact_count_search():
response = request_with_validation(
api='/collections/{collection_name}/points/count',
method="POST",
path_params={'collection_name': collection_name},
body={
"filter": {
"should": [
{
"key": "city",
"match": {
"value": "London"
}
},
{
"key": "city",
"match": {
"value": "Berlin"
}
}
]
}
}
)
assert response.ok
assert response.json()['result']['count'] == 4
def test_approx_count_search():
response = request_with_validation(
api='/collections/{collection_name}/points/count',
method="POST",
path_params={'collection_name': collection_name},
body={
"filter": {
"should": [
{
"key": "city",
"match": {
"value": "London"
}
},
{
"key": "city",
"match": {
"value": "Berlin"
}
}
]
},
"exact": False
}
)
assert response.ok
assert response.json()['result']['count'] < 8
assert response.json()['result']['count'] > 0