From e32f72e49c39c7eff0329a9579fec8714d038f8d Mon Sep 17 00:00:00 2001 From: Jon Bratseth Date: Mon, 24 Aug 2026 09:50:27 +0200 Subject: [PATCH] Improve 'alternatives' doc --- en/reference/querying/yql.html | 38 ++++++++++------------------------ 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/en/reference/querying/yql.html b/en/reference/querying/yql.html index 48fb853faa..b12a4d61af 100644 --- a/en/reference/querying/yql.html +++ b/en/reference/querying/yql.html @@ -448,40 +448,24 @@

where

alternatives - -

- Use alternatives to provide alternative terms, with an exactness score, to improve recall. - Think of it like a special case of the or operator. -

+ +

+ The alternatives operator is used to provide multiple variants of a token at the same + position in the query. The token alternatives are given with a normalized exactness score denoting the extent to + which they mean "the same thing" as the first alternative. +

 where fieldName contains alternatives({"sneakers":1.0, "shoes":0.7})
 
+

- In alternatives({"sneakers":1.0, "shoes":0.7}), each number is an exactness score for that specific word form, - not a term weight in the usual boosting sense: + The query will match documents containing any of the alternatives given. The exactness score is reflected + in some rank features, such that it is possible to rank more exact matches over less exact ones. + Use 1.0 as the exactness of all alternatives if exactness information is not available or appropriate.

-

- Typical use case: query rewriting/stemming, - where you search for both the literal user term and a stemmed/synonym form, - but want the literal form to rank higher. - E.g. alternatives({"sneakers":1.0, "shoes":0.7})‚ either matches, - but a document matching "sneakers" literally ranks above one that only matched via the stem "shoes". + Prefer alternatives to equiv when the purpose is to express alternative forms of a single token.

-