---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/context/thrift/relevance/functions/relevanceToQuery.md
---

# Function: relevanceToQuery()

```ts
function relevanceToQuery(
  text: string,
  queryTokens: ReadonlySet<string>,
): number;
```

Defined in: [src/batteries/context/thrift/relevance.ts:135](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/batteries/context/thrift/relevance.ts#L135)

What fraction of the QUERY's content words appear in `text` — the relevance of a prior turn to the
CURRENT query (not the reverse: a turn need not share all its own content, only enough of the
query's).

## Parameters

| Parameter     | Type                      | Description                                                                   |
| ------------- | ------------------------- | ----------------------------------------------------------------------------- |
| `text`        | `string`                  | The candidate turn's combined text (see `HistoryTurn.qa`).                    |
| `queryTokens` | `ReadonlySet`<`string`> | The current query's content-word set, from [contentTokens](contentTokens.md). |

## Returns

`number`

A fraction in `[0, 1]`; `0` when `queryTokens` is empty (an empty query matches nothing).
