Home / Function/ test_qdrant_similarity_search_filters_with_qdrant_filters() — langchain Function Reference

test_qdrant_similarity_search_filters_with_qdrant_filters() — langchain Function Reference

Architecture documentation for the test_qdrant_similarity_search_filters_with_qdrant_filters() function in test_similarity_search.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  55c10f49_c591_333c_8868_a58b425626c3["test_qdrant_similarity_search_filters_with_qdrant_filters()"]
  5b7f0668_b386_695d_06c0_77020a3462af["test_similarity_search.py"]
  55c10f49_c591_333c_8868_a58b425626c3 -->|defined in| 5b7f0668_b386_695d_06c0_77020a3462af
  style 55c10f49_c591_333c_8868_a58b425626c3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/qdrant/tests/integration_tests/test_similarity_search.py lines 213–255

def test_qdrant_similarity_search_filters_with_qdrant_filters(
    vector_name: str | None,
) -> None:
    """Test end to end construction and search."""
    texts = ["foo", "bar", "baz"]
    metadatas = [
        {"page": i, "details": {"page": i + 1, "pages": [i + 2, -1]}}
        for i in range(len(texts))
    ]
    docsearch = Qdrant.from_texts(
        texts,
        ConsistentFakeEmbeddings(),
        metadatas=metadatas,
        location=":memory:",
        vector_name=vector_name,
    )

    qdrant_filter = rest.Filter(
        must=[
            rest.FieldCondition(
                key="metadata.page",
                match=rest.MatchValue(value=1),
            ),
            rest.FieldCondition(
                key="metadata.details.page",
                match=rest.MatchValue(value=2),
            ),
            rest.FieldCondition(
                key="metadata.details.pages",
                match=rest.MatchAny(any=[3]),
            ),
        ]
    )
    output = docsearch.similarity_search("foo", k=1, filter=qdrant_filter)
    assert_documents_equals(
        actual=output,
        expected=[
            Document(
                page_content="bar",
                metadata={"page": 1, "details": {"page": 2, "pages": [3, -1]}},
            )
        ],
    )

Domain

Subdomains

Frequently Asked Questions

What does test_qdrant_similarity_search_filters_with_qdrant_filters() do?
test_qdrant_similarity_search_filters_with_qdrant_filters() is a function in the langchain codebase, defined in libs/partners/qdrant/tests/integration_tests/test_similarity_search.py.
Where is test_qdrant_similarity_search_filters_with_qdrant_filters() defined?
test_qdrant_similarity_search_filters_with_qdrant_filters() is defined in libs/partners/qdrant/tests/integration_tests/test_similarity_search.py at line 213.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free