Skip to main content
Semantic search matches by meaning: a question about “time off” finds a document about “annual leave.” Keyword search matches the words themselves, which is what you need for an error code such as E_AUTH_429. POST /query runs both together by default, a combination called hybrid search, so one request handles paraphrases and exact identifiers. BM25 is the keyword-ranking method it uses. In this guide:
  1. Choose the matching method: query_by, and the three signals a query can use.
  2. Balance meaning and keywords: the alpha value.
  3. Where meaning alone falls short: why HydraDB has no pure vector mode.

1. Choose the matching method

query_by picks how the query text is matched:
  • "hybrid" (the default): matching by meaning and BM25 keyword matching, blended by alpha. Use it unless you have a reason not to.
  • "text": BM25 only. Use it when the literal wording is the point, such as a legal clause, a SKU, or a function name. operator says how the terms must match: "or" (the default), "and", or "phrase". "and" and "phrase" are valid only with query_by: "text".
A hybrid query can also draw on a third signal, the context graph, which is returned with the results when graph_context is on (the default):
The first request is a hybrid search kept inside the phoenix project with a metadata filter. The second returns only passages that contain the exact phrase “mechanical engineer”.
metadata_filters are exact constraints. They run before ranking and are re-checked after the matching passages load, so use them for any scope the query must not cross. Top-level keys match metadata and support equals, contains, and contains_any; there is no range or fuzzy match. Nest free-form per-document fields under additional_metadata. See Metadata.

2. Balance meaning and keywords with alpha

alpha sets the blend in a hybrid query. Higher values lean on meaning; lower values lean on keywords. Start with the default and tune from observed results. "auto" also resolves to 0.8. If users query for exact IDs and get loosely related results, lower alpha. If they ask broad conceptual questions and get sparse results, raise it. alpha applies only to query_by: "hybrid"; it is ignored for "text".
Lower alpha when names, IDs, and literal strings matter but the query still has a natural-language part.

3. Where meaning alone falls short

Pure vector search misses things that matter in production:
  • Exact identifiers such as E_AUTH_429 or payments-worker-v4 may be generalized away.
  • A project name can collide with a normal word, like strawberry the project and strawberry the fruit.
  • Old and new documents can look equally relevant without recency or metadata signals.
  • Different users can need different context for the same query.
  • Relationship questions need graph context, not only similar text chunks.
That is why HydraDB exposes semantic retrieval through query_by: "hybrid" inside the one /query endpoint rather than as a separate pure-vector mode. The keyword, recency, metadata, scope, and graph signals ride along with it.