csquery v1.0.0 CSQuery.Expression View Source

A representation of an expression in the AWS CloudSearch structured query syntax.

Link to this section Summary

Types

Valid operator names

t()

The CSQuery.Expression struct

Functions

Provide a CSQuery.Expression struct for the provided value

Provide a CSQuery.Expression struct for the operator and conditions

Convert the parsed query expression to the AWS CloudSearch structured query syntax string

Link to this section Types

Link to this type operators() View Source
operators() :: :and | :near | :not | :or | :phrase | :prefix | :range | :term

Valid operator names.

Link to this type t() View Source
t() :: %CSQuery.Expression{
  fields: [CSQuery.FieldValue.t()],
  operator: operators(),
  options: [CSQuery.OperatorOption.t()]
}

The CSQuery.Expression struct.

Link to this section Functions

Link to this function new(value) View Source
new(keyword()) :: [t()] | no_return()
new(t()) :: t()

Provide a CSQuery.Expression struct for the provided value.

If the value is a keyword list, the CSQuery.Expression will be constructed from the keyword pairs. Each keyword pair will be parsed as an operator and list (effectively calling new/2 as &new(elem(&1, 0), elem(&1, 1))).

An exception will be raised if there is an invalid expression constructed.

If the value is a CSQuery.Expression struct, it will be returned.

iex> CSQuery.Expression.new(%CSQuery.Expression{operator: :and})
%CSQuery.Expression{operator: :and}
Link to this function new(op, conditions) View Source
new(:and, list()) :: t() | no_return()
new(:or, list()) :: t() | no_return()
new(:near, list()) :: t() | no_return()
new(:not, list()) :: t() | no_return()
new(:term, list()) :: t() | no_return()
new(:phrase, list()) :: t() | no_return()
new(:prefix, list()) :: t() | no_return()
new(:range, list()) :: t() | no_return()

Provide a CSQuery.Expression struct for the operator and conditions.

See CSQuery.and!/1, CSQuery.near!/1, CSQuery.not!/1, CSQuery.or!/1, CSQuery.phrase!/1, CSQuery.prefix!/1, CSQuery.range!/1, and CSQuery.term!/1 for the details on how expressions are built.

An exception will be raised if there is an invalid expression constructed.

Link to this function to_query(query) View Source
to_query(nil) :: String.t()
to_query([t()]) :: [String.t()]
to_query(t()) :: String.t()

Convert the parsed query expression to the AWS CloudSearch structured query syntax string.

If a list of queries is provided, convert each item to structured query syntax.