def test_search(node_embeddings: List[TextNode]) -> None:
    """Test end to end construction and search."""
    tidbvec = TiDBVectorStore(
        table_name=VECTOR_TABLE_NAME,
        connection_string=CONNECTION_STRING,
        drop_existing_table=True,
    )

    # Add nodes to the tidb vector
    tidbvec.add(node_embeddings)

    # similarity search
    q = VectorStoreQuery(query_embedding=text_to_embedding("foo"), similarity_top_k=1)

    result = tidbvec.query(q)
    tidbvec.drop_vectorstore()
    assert result.nodes is not None and len(result.nodes) == 1
    assert (
        result.nodes[0].get_content(metadata_mode=MetadataMode.NONE)
        == node_embeddings[0].text
    )
    assert result.similarities is not None and result.similarities[0] == 1.0
    assert result.ids is not None and result.ids[0] == node_embeddings[0].node_id
Test end to end construction and search.
llama-index-integrations/vector_stores/llama-index-vector-stores-tidbvector/tests/test_vector_stores_tidbvector.py