Skip to end of metadata
Go to start of metadata

The ExpressionBuilder object is used to build a single query expression. It allows combining multiple expression parts into a single string and provides utilities to generate common expression parts.

Properties

This object has no properties.

Methods

add

expressionBuilder.add(expression:string)

Adds an expression to the ExpressionBuilder.

expression : The expression to add.

addFieldExpression

expressionBuilder.addFieldExpression(field:string, operator:string, values:string[])

Adds an expression of the form @field=(values) to the ExpressionBuilder.

field : The name of the field, including the @ character.

operator : The operator to use, such as ===<>, etc.

values : The values to put in the expression.

addFieldNotEqualExpression

expressionBuilder.addFieldNotEqualExpression(field:string, values:string[])

Adds an expression of the form (NOT @field==value) to the ExpressionBuilder.

field : The name of the field, including the @ character.

Icon

The expressions generated by this method are used to select all items for which the field does not equal the specified values, as well as items for which the field is not set. This is different from expressions of the form @field<>value, which only select items whose field is set to another value than value.

remove

expressionBuilder.remove(expression:string)

Removes an expression from the builder.

expression : The expression to remove.

isEmpty

expressionBuilder.isEmpty()

Checks if the builder is currently empty.

build

var expression = expressionBuilder.build()

Builds the expression string by combining all the parts together.

Returns the built expression string.

ExpressionBuilder.merge

var mergedBuilder = Coveo.Ui.ExpressionBuilder.merge(builder1, builder2)

Merges several ExpressionBuilder objects together.

Returns the merged ExpressionBuilder.

  • No labels