A utility to help build query expressions.

interface QueryExpression {
    addDateField(expression: DateFieldExpression): QueryExpression;
    addDateRangeField(expression: DateRangeFieldExpression): QueryExpression;
    addExactMatch(expression: ExactMatchExpression): QueryExpression;
    addExpression(expression: QueryExpression): QueryExpression;
    addFieldExists(expression: FieldExistsExpression): QueryExpression;
    addKeyword(expression: KeywordExpression): QueryExpression;
    addNear(expression: NearExpression): QueryExpression;
    addNumericField(expression: NumericFieldExpression): QueryExpression;
    addNumericRangeField(
        expression: NumericRangeFieldExpression,
    ): QueryExpression;
    addQueryExtension(expression: QueryExtensionExpression): QueryExpression;
    addStringFacetField(
        expression: StringFacetFieldExpression,
    ): QueryExpression;
    addStringField(expression: StringFieldExpression): QueryExpression;
    joinUsing(operator: BooleanOperator): QueryExpression;
    toQuerySyntax(): string;
}

Methods

  • Adds an expression that uses an operator to compare a date field to a value. Returns all of the items for which the expression evaluates to true.

    Parameters

    Returns QueryExpression

    The QueryExpression instance.

  • Adds an expression that returns all items for which the value of the date field is within the defined range.

    Parameters

    Returns QueryExpression

    The QueryExpression instance.

  • Adds an expression that must appear in its entirety, at least once, for an item to be returned.

    Parameters

    Returns QueryExpression

    The QueryExpression instance.

  • Adds a QueryExpression to the current instance.

    Parameters

    Returns QueryExpression

    The QueryExpression instance.

  • Adds an expression containing terms to match. Terms can be in any order, and may also be expanded with stemming.

    Parameters

    Returns QueryExpression

    The QueryExpression instance.

  • Adds an expression that returns all of the items in which the specified startTerm appears no more than maxKeywordsBetween from the endTerm, for each element in otherTerms.

    Parameters

    Returns QueryExpression

    The QueryExpression instance.

  • Adds an expression that uses an operator to compare a numeric field to a value. Returns all of the items for which the expression evaluates to true.

    Parameters

    Returns QueryExpression

    The QueryExpression instance.

  • Adds an expression that uses an operator to compare a string facet field to a value. Returns all of the items for which the expression evaluates to true.

    Parameters

    Returns QueryExpression

    The QueryExpression instance.

  • Adds an expression that uses an operator to compare a string field against certain values. Returns all of the items for which the expression evaluates to true.

    Parameters

    Returns QueryExpression

    The QueryExpression instance.

  • Allows specifying a boolean operator join expressions with. Possible values are and and or.

    Parameters

    • operator: BooleanOperator

      The boolean operator to join individual expressions with.

    Returns QueryExpression

    The QueryExpression instance.

  • Joins all expressions using the configured boolean operator.

    Returns string

    A string representation of the configured expressions.