Analytics Legends logoAI & Analytics Legends Sign inSign up
Concept card

Hybrid search in SAP HANA Cloud — vector similarity and fuzzy text search in one SQL statement

Hybrid search in SAP HANA Cloud — vector similarity and fuzzy text search in one SQL statement — Analytics Legends section illustration for the SAP Analytics knowledge base (concepts, studies, Academy)

As of 2026-10-28

What is Hybrid search in SAP HANA Cloud?

Hybrid search ranks rows by two scores at once: semantic closeness of embeddings (COSINE_SIMILARITY on a REAL_VECTOR column) and lexical closeness of the words (CONTAINS with FUZZY and SCORE()). In SAP HANA Cloud both live in the same database, so one SQL statement can compute, weight and sort them under the caller's privileges. A demo at SAP TechEd 2026 used this pattern behind a CAP service called by a Joule Studio agent; its 60/40 weighting is a demo choice to be tuned on your own evaluation set.

What hybrid search is

A vector search answers "which rows mean something close to my question"; a text search answers "which rows contain these words, even misspelled". Each fails where the other succeeds. Embeddings blur exact identifiers: a material number, a product code or a customer name that matters letter by letter comes back as "something similar". Fuzzy text search misses paraphrases: "cordless drill for masonry" does not match "battery hammer drill for concrete". Hybrid search scores every candidate on both and ranks on a weighted combination, so a row that is close in meaning and in wording rises to the top.

The two scores SAP HANA Cloud gives you

Semantic score. SAP HANA Cloud stores embeddings in the REAL_VECTOR data type (or HALF_VECTOR), with a fixed dimension that follows the embedding model: 768 for the in-database SAP_NEB model, 1,536 in the TechEd demo. COSINE_SIMILARITY(a, b) returns a value where higher means closer; L2DISTANCE is the alternative where lower means closer. The query vector comes either from VECTOR_EMBEDDING() inside the database or from an embedding model in SAP AI Core, passed in with TO_REAL_VECTOR(). Documents and queries must be embedded with the same model (SAP HANA Cloud Vector Engine Guide).

Why it matters

  • Agents grounded on business data fail most often on exact identifiers (codes, names) that pure vector search blurs.
  • Keeping both searches in SAP HANA Cloud removes a second search engine and keeps the table's privileges on the search.
  • The pattern is the retrieval step of a CAP-based agent tool, the kind of side-by-side extension SAP grades clean core level A.

Key points

  • Hybrid search ranks rows on a weighted sum of a semantic score (COSINE_SIMILARITY on REAL_VECTOR) and a lexical score (CONTAINS … FUZZY with SCORE()).
  • In SAP HANA Cloud both scores are computed in one SQL statement, under the caller's database privileges.
  • Vectors catch paraphrases; fuzzy text catches exact identifiers and typos: each covers the other's blind spot.
  • SCORE() lies between 0 and 1, cosine similarity between -1 and 1: normalise before weighting.
  • The 60/40 weighting shown at SAP TechEd 2026 is the demo's choice; tune weights or rank fusion on an evaluation set.
  • An HNSW vector index speeds the vector part; a full-text index serves long text columns.
  • Documents and queries must be embedded with the same, versioned model; the vector dimension follows that model.
  • Wrapped in a CAP service on SAP BTP that calls released S/4HANA APIs, it is a clean core level A side-by-side extension; HANA Cloud is its persistence.

Terms used on this page

Hybrid search
Ranking on a combination of a semantic (vector) score and a lexical (text) score.
REAL_VECTOR
SAP HANA Cloud data type for a fixed-dimension vector of 32-bit floats.
COSINE_SIMILARITY
SAP HANA Cloud function returning the cosine of the angle between two vectors; higher is closer.
Fuzzy search
Text search tolerant of typos and variants, called with CONTAINS … FUZZY(threshold).
SCORE()
Relevance of a CONTAINS match, between 0 and 1.
HNSW index
Approximate nearest-neighbour index for vector columns in SAP HANA Cloud.
Rank fusion
Combining two ranked lists by adding 1/(k + rank) from each.
HDI container
Isolated schema in SAP HANA Cloud to which a CAP application deploys its database artefacts.

Sources

  1. SAP TechEd 2026 (Berlin & virtual, 27–29 Oct 2026) — session DA164: Building agentic applications with SAP HANA Cloud (demo architecture: Joule Studio agent, CAP service, SAP HANA Cloud hybrid search, SAP AI Core)
  2. SAP Help — SAP HANA Cloud Vector Engine Guide
  3. SAP Help — Vector Engine Guide: REAL_VECTOR and HALF_VECTOR data types
  4. SAP Help — SQL reference: COSINE_SIMILARITY function (vector)
  5. SAP Help — Vector Engine Guide: CREATE VECTOR INDEX statement (HNSW)
  6. SAP Help — Vector Engine Guide: Using the VECTOR_EMBEDDING function
  7. SAP Help — SAP HANA Cloud Search Developer Guide (CONTAINS, FUZZY, SCORE(), full-text indexes)
  8. SAP Architecture Center — Embeddings & Semantic Search
  9. SAP Architecture Center — Building AI Agents with Joule Studio
  10. CAP documentation — Vector Embeddings (cds.Vector, cosine_similarity in CQL)
  11. CAP documentation — SAP HANA Cloud as database (HDI deployment)
  12. CAP documentation — Model Context Protocol (MCP) adapter (@cap-js/mcp)
  13. SAP News — How to extend SAP S/4HANA Cloud the right way: clean core levels A–D (Aug 2025)

Full card with the Consultant plan — €19.90/month. What the full card adds: the full decision framework · the SAP vs Snowflake / Databricks / Fabric comparison · the common pitfalls and their fix · the cheat sheet · the architecture schemas · the code blocks · the facts worth quoting.

Open in the app →

Open missions

SAP analytics jobs and contracts · freelance SAP contracts.