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
36 changes: 36 additions & 0 deletions integration/test_collection_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,42 @@ def test_hnsw_with_rq4c(collection_factory: CollectionFactory) -> None:
assert config.vector_index_config.quantizer.training_limit == 10000


def test_hnsw_with_pathseer_filter_strategy(collection_factory: CollectionFactory) -> None:
dummy = collection_factory("dummy")
if dummy._connection._weaviate_version.is_lower_than(1, 40, 0):
pytest.skip(
"pathseer filter strategy is not supported in Weaviate versions lower than 1.40.0"
)

collection = collection_factory(
vector_index_config=Configure.VectorIndex.hnsw(
filter_strategy=wvc.config.VectorFilterStrategy.PATHSEER,
),
)

config = collection.config.get()
assert isinstance(config.vector_index_config, _VectorIndexConfigHNSW)
assert config.vector_index_config.filter_strategy == wvc.config.VectorFilterStrategy.PATHSEER

collection.config.update(
vector_index_config=Reconfigure.VectorIndex.hnsw(
filter_strategy=wvc.config.VectorFilterStrategy.ACORN,
),
)
config = collection.config.get()
assert isinstance(config.vector_index_config, _VectorIndexConfigHNSW)
assert config.vector_index_config.filter_strategy == wvc.config.VectorFilterStrategy.ACORN

collection.config.update(
vector_index_config=Reconfigure.VectorIndex.hnsw(
filter_strategy=wvc.config.VectorFilterStrategy.PATHSEER,
),
)
config = collection.config.get()
assert isinstance(config.vector_index_config, _VectorIndexConfigHNSW)
assert config.vector_index_config.filter_strategy == wvc.config.VectorFilterStrategy.PATHSEER


@pytest.mark.parametrize(
"vector_index_config",
[
Expand Down
11 changes: 11 additions & 0 deletions test/collection/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
_VectorizerConfigCreate,
_ReplicationConfigCreate,
ReplicationDeletionStrategy,
VectorFilterStrategy,
)
from weaviate.collections.classes.config_named_vectors import _NamedVectorConfigCreate
from weaviate.collections.classes.config_vectorizers import (
Expand Down Expand Up @@ -1664,6 +1665,16 @@ def test_vector_config_hnsw_rq4c() -> None:
assert vi_dict["rq"]["trainingLimit"] == 5012


def test_vector_config_hnsw_pathseer_filter_strategy() -> None:
vector_index = Configure.VectorIndex.hnsw(
filter_strategy=VectorFilterStrategy.PATHSEER,
)

vi_dict = vector_index._to_dict()

assert vi_dict["filterStrategy"] == "pathseer"


def test_vector_config_flat_pq() -> None:
vector_index = Configure.VectorIndex.flat(
distance_metric=VectorDistances.DOT,
Expand Down
2 changes: 2 additions & 0 deletions weaviate/collections/classes/config_vector_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ class VectorFilterStrategy(str, Enum):
Attributes:
SWEEPING: Do normal ANN search and skip nodes.
ACORN: Multi-hop search to find new candidates matching the filter.
PATHSEER: Adaptive search that decides per query between sweeping and multi-hop candidate discovery.
"""

SWEEPING = "sweeping"
ACORN = "acorn"
PATHSEER = "pathseer"


class VectorIndexType(str, Enum):
Expand Down
Loading