Oihana PHP Arango

boost.php

Table of Contents

Functions

boost()  : string
Override the boost value of a search sub-expression.

Functions

boost()

Override the boost value of a search sub-expression.

boost(string $expr, float|int $boost) : string

Wraps the ArangoDB AQL function BOOST(expr, boost). The boost value is made available to scorer functions (bm25(), tfidf()) so that matches of the wrapped sub-expression weigh more (or less) in the final score. The default boost of any search context is 1.0.

Example AQL usage:

ANALYZER(BOOST(doc.text == "foo", 2.5) OR doc.text == "bar", "text_en")
Parameters
$expr : string

Any valid search expression (kept raw).

$boost : float|int

Numeric boost value.

Tags
example
use function oihana\arango\db\functions\search\boost;

$expr = boost( 'doc.name == "wood"' , 2.5 ) ;
// 'BOOST(doc.name == "wood",2.5)'
see
https://docs.arangodb.com/stable/aql/functions/arangosearch/#boost
analyzer()
bm25()
since
1.2.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression.

On this page

Search results