Guide To Vectors
  • Introduction
  • Guide to this Book
  • API documentation
  • Python SDK Documentation
  • Learn about vectors
    • 🌱Introduction to vectors
      • 🌱Applications of vectors
        • 🌱Vectors for classification
      • 🌱Limitations of vectors
    • 🌱What is vector search?
      • 🌱How to vector search
      • 🌱How to build image to text search using code
      • 🧍Try vector search with playground!
      • 💻Vector search with code
    • 🌱Terminology Guide
  • Unlock Vector AI
    • 🔍Inserting Into Vector AI
      • 🧍Inserting with playground
      • 💻Inserting with API
        • 💻Inserting with API - encoding while inserting (recommended)
        • 💻Inserting with API - encoding before inserting
        • 💻Inserting with API - encoding after inserting
      • 🧍How to check insertion succeeded
    • 🔍Searching with Vector AI
      • 🌱How to search with the playground
      • 🌱Combining with traditional search
        • 🧍How to combine exact text search with vector search
        • 💻How to add exact text search to vector search
      • 🌱Personalisation with vector search
        • 💻Personalised search/recommendations with vector search
      • 🌱Chunk search
        • 💻How To Chunk Search
        • 💻How To Do MultiVector Chunk Search
        • 💻How to do multi step chunk search
      • 🧍How to diversify search results
    • 🔍Clustering
      • 🌱Clustering Vectors From Deep Learning models
    • 🔍Aggregation
      • 💻Writing Your First Aggregation
      • 💻Publishing Your First Aggregation
    • 🔍Experimentation
      • 🌱Vector Evaluation
        • 🌱Evaluate Vector Bias
    • 🔍Jobs
      • 💻Tagging Jobs
      • 💻Chunking Jobs
      • 💻Encoding Jobs
      • 🧍List all jobs (active and inactive)
    • 🔍Encoding
    • 🔍Maintenance & Monitoring
      • 🧍How to view your collections
      • 💻How to share your collections
      • 💻How to back up your collections
      • 💻How to change name of a collection field
      • 💻How to change the schema of a collection
      • 💻How to remove a field in a collection
      • 💻How to request a read API key
  • Tutorials
    • 💻How to turn data into Vectors (code)
      • 💻How to turn text into Vectors
      • 💻How to turn images Into Vectors
      • 💻How to turn audio into Vectors
    • 💻Image Search For Developers
    • 💻How To Combine Different Vectors For Search
    • 💻How To Combine Different Vectors With Exact Matching Text
    • 💻Semantic NLP search with FAISS and VectorHub
  • ABOUT
    • Credits
    • Philosophy
    • Glossary
Powered by GitBook
On this page

Was this helpful?

  1. Unlock Vector AI
  2. Searching with Vector AI
  3. Combining with traditional search

How to add exact text search to vector search

Introducing hybrid search and its importance

PreviousHow to combine exact text search with vector searchNextPersonalisation with vector search

Last updated 4 years ago

Was this helpful?

Assumed Knowledge: Vectors Target Audience: General Audience / Python developers Reading Time: 3 minutes

There are sometimes search cases where pure vector search often does not provide the best solution. For example - we can take the simple case of product SKUs in retail e-commerce. Product SKUs are the name of the products.

E-Commerce Case Study

Weakness Of Vector Search

Below, we use an example of vector search where an individual searches for an SKU. However, the search results encode the letters and fail to realize/return the right SKU. We also attach a code example using the Vector AI client for those interested in trying this out.

search_results = vi_client.search(
collection_name, 
text_encoder.encode('R170NZKAXSA'), 'name_vector_', page_size=3)
vi_client.show_json(search_results, selected_fields=['_id', 'name', 'sku'],
    image_fields=['image_url'], image_width=150)

In these situations, our search should properly return the right value when given the SKU. In turn, hybrid search can return the right result.

search_results = vi_client.hybrid_search(collection_name, 'R170NZKAXSA',
      text_encoder.encode('R170NZKAXSA'),
      fields=['name_vector_'], text_fields=['name'],
      traditional_weight=0.015,
      page_size=3)
vi_client.show_json(search_results, selected_fields=['_id', 'name', 'sku'],
    image_fields=['image_url'], image_width=150)

From above, we realize that the value of hybrid search allows us to match items/products when exact values are known by the searcher.

If you are interested in exploring documentation around hybrid search, you can find that

🔍
🌱
💻
here.
Result from pure vector search
Hybrid search example