tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Generative AI > Vector Databases > Weaviate Vector Search with Python

Weaviate Vector Search with Python

Author: Venkata Sudhakar

Weaviate is an open-source vector database that combines vector search with structured filtering in a single query. Unlike Pinecone which stores only vectors and metadata, Weaviate stores full objects with typed properties and lets you filter by any property while simultaneously ranking by vector similarity. This makes it ideal for product search scenarios where you need both semantic relevance and hard attribute constraints.

Weaviate uses GraphQL-style queries and supports multiple vectorisation modules including text2vec-openai and text2vec-cohere. You can run Weaviate locally with Docker or use Weaviate Cloud Services for managed hosting. Its schema system enforces data types, making it easier to build consistent data pipelines compared to schema-free alternatives.

The below example sets up a local Weaviate instance, creates a ShopMax India product schema, inserts product objects, and performs hybrid search combining semantic and keyword matching.


It gives the following output,

Smartphones under Rs 70000:
  OnePlus 12 - Rs 64999.0 (Delhi)
  Sony WH-1000XM5 - Rs 29999.0 (Mumbai)

Weaviate combined the vector similarity ranking with a hard price filter in a single query - no post-filtering required. The filter runs before the vector search, ensuring only eligible products are ranked. Use Weaviate for ShopMax product search when you need attribute filters (price range, category, city, brand) alongside semantic relevance scoring. Replace the random vectors with real Gemini or sentence-transformer embeddings for production use.


 
  


  
bl  br