VecDB API
  • 🌱VecDB
  • 🌱Structure
  • 🌱Glossary
  • 🌱FAQ
  • πŸ’»API Reference
  • Get Started
    • πŸ’»Authentication
    • πŸ’»Build Your First Search
      • πŸ’»Creating your first dataset
      • πŸ’»Encoding + Inserting
      • πŸ’»Your First Text To Image Search!
  • for your understanding
    • 🌱Concepts about vectors
    • 🌱What is vector search?
    • 🌱Vectors for classification
    • 🌱Limitations of vectors
  • Guides
    • πŸ’»Combine keyword search with vector search
  • ADMIN
    • 🌱Project Overview
      • πŸ’»Project Creation
      • πŸ’»List All Datasets
      • Best Practice With Project Management
      • πŸ’»Copy dataset
      • πŸ’»Copy dataset from another project
      • πŸ’»Request an API key
      • πŸ’»Request a read-only API key
  • Services
    • πŸ”Search
      • Text Search
      • Vector Search
      • Hybrid Search
      • Traditional Search
    • πŸ”Predict
      • πŸ’»KNN regression from search results
      • πŸ’»KNN Regression
    • πŸ”Tag
      • πŸ’»Tagging
      • πŸ’»Diversity Tagging
    • πŸ”Cluster
      • Cluster A Dataset Field
  • DATASETS
    • 🌱Datasets Overview
      • 🌱Special Field Types
  • WORKFLOWS
    • 🌱Workflow Overview
Powered by GitBook
On this page
  • 1. Identifying strength & weaknesses of vector search
  • 2. Identifying strengths & weaknesses of traditional search
  • 3. Combing both for a hybrid search

Was this helpful?

  1. Guides

Combine keyword search with vector search

Tutorial on combining keyword search with vector search

PreviousLimitations of vectorsNext🌱Project Overview

Last updated 3 years ago

Was this helpful?

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.

1. Identifying strength & weaknesses 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(
    dataset_id,
    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)

2. Identifying strengths & weaknesses of traditional search

3. Combing both for a hybrid search

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.

πŸ’»
Result from pure vector search
Hybrid search example