Skip to main content
This guide demonstrates three powerful search techniques using the cohere-wikipedia-en-100k collection in your LambdaDB project. Each example showcases different approaches to finding the most relevant information from your data.

🚀 Prerequisites

Before running these examples, ensure you have: Required credentials:
  • Cohere API key from cohere.com
  • LambdaDB project API key for a project that contains the cohere-wikipedia-en-100k collection
Get your project API key from LambdaDB Cloud: sign in at app.lambdadb.ai, open your project, and copy the API key, base URL, and project name from the console. This guide assumes the cohere-wikipedia-en-100k collection already exists in that project with title, url, text, and vector fields. For signup and project setup, see the Quickstart.
Installation:

⚙️ Initial setup

🎯 Example 1: Hybrid search with combined scoring

💡 When to use: This is your go-to search method when you want the most comprehensive and accurate results. Perfect for general queries where you need both keyword relevance and semantic understanding. 🔧 How it works: Combines traditional full-text search with vector similarity using hybrid scoring strategies like Reciprocal Rank Fusion (rrf), L2 distance (l2), or Min-Max (mm) normalization—flexibly choosing the best fit for your use case.
Check out this page for more details about hybrid query and scoring.
Expected results:

🏷️ Example 2: Hybrid search with keyword filtering

💡 When to use: Perfect when you want to search within a specific category or document type. Use this when you know the general category but need semantic ranking within that subset. 🔧 How it works: First filters documents by specific keywords (like titles starting with “List”), then applies semantic search within those filtered results.
Expected results:
💡 Tip: To apply the keyword filter to semantic search as well, move it to the filter parameter within the knn query:

🎯 Example 3: Vector search with exact match filtering

💡 When to use: Ideal when you know the exact document or URL and want to find the most relevant content within it. Perfect for document-specific Q&A scenarios. 🔧 How it works: Filters to an exact URL match, then uses vector similarity to rank the most relevant sections within that specific document.
Expected results:

🔧 Complete working example

Here’s a complete script that runs all three examples with proper error handling:

📋 Search method comparison

🎯 Best practices

✅ Configuration tips

  • Set skipSyntax: true for user inputs that may contain special characters.
  • Use appropriate k values (5-20 for most use cases).
  • Choose RRF for best overall search quality.
  • Apply filters in knn.filter for semantic search within filtered results.

🚀 Performance optimization

  • Use smaller k values for faster vector search.
  • Combine multiple filters in boolean queries for precise targeting.
  • Consider using l2 or mm (min-max) normalization for simpler score interpretation.

➡️ Next step

  • LambdaDB Cloud: Sign up and manage projects in the console at app.lambdadb.ai.

🤝 Support

Need help with your implementation? Check out our: