---
title: Const Score
noindex: true
---

<Danger>
  **Legacy Docs:** This page describes our legacy API. It will be deprecated in
  a future version. Please use the [v2 API](/) where possible.
</Danger>

## Basic Usage

Applies a constant score across all documents matched by the underlying query. It can avoid unnecessary score computation on the wrapped query.

<CodeGroup>
```sql Function Syntax
SELECT description, rating, category, pdb.score(id)
FROM mock_items
WHERE id @@@ paradedb.boolean(
  should => ARRAY[
    paradedb.const_score(1.0, paradedb.term('description', 'shoes')),
    paradedb.term('description', 'running')
  ]
);
```
```sql JSON Syntax
SELECT description, rating, category, pdb.score(id)
FROM mock_items
WHERE id @@@
'{
    "boolean": {
        "should": [
            {"const_score": {"score": 1.0, "query": {"term": {"field": "description", "value": "shoes"}}}},
            {"term": {"field": "description", "value": "running"}}
        ]
    }
}'::jsonb;
```
</CodeGroup>

<div className="mt-8" />

<ParamField body="score" required>
  The constant score to use for each result.
</ParamField>
<ParamField body="query" required>
  The query to perform.
</ParamField>
