SearchHybrid Search

Hybrid Search

Combines both semantic and keyword search capabilities to provide comprehensive results that match both meaning and specific terms.

When you need results that match both concepts and exact terms, Hybrid Search is your solution. For example, searching for “AI in healthcare” will find documents that are conceptually about healthcare AI and contain those specific keywords.

const {
  data: { payload }
} = await unbody.get
                .textDocument
                .search.hybrid("AI in healthcare", {
                  properties: ["text", "title"]
                })
                .select("title", "text", "autoSummary")
                .exec();

Sometimes you need to fine-tune your search results by combining semantic vectors with specific keyword matching. Using Advanced Hybrid Search, you can prioritize certain fields like titles and tags while maintaining semantic relevance.

const {
  data: { payload }
} = await unbody.get
                .googleDoc
                .search.hybrid("Generative AI", {
                  alpha: 0.7,
                  vector: [0.0055148206, 0.013368472, 0.035909854],
                  fusionType: "relativeScoreFusion",
                  properties: ["title", "tags"]
                })
                .exec();

Learn more in our Hybrid Search Guide.

©2024 Unbody