--- title: Const Score --- ## Basic Usage Applies a constant score across all documents matched by the underlying query. It can avoid unnecessary score computation on the wrapped query. ```sql Function Syntax SELECT description, rating, category, paradedb.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, paradedb.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; ```
The constant score to use for each result. The query to perform.