csquery v1.0.0 CSQuery.FieldValue View Source

A representation of a field value pattern matcher for the AWS CloudSearch structured query syntax. If the CSQuery.FieldValue does not have a name, then all text and text-array fields will be searched. If it does have a name, then only the named field will be searched.

Link to this section Summary

Types

Valid name types for a CSQuery.FieldValue struct

t()

The struct for CSQuery.FieldValue

Valid value types for a CSQuery.FieldValue.t/0

Functions

Provide an unnamed CSQuery.FieldValue struct for the value provided

Provide an optionally named CSQuery.FieldValue struct. The value may be one of values/0, nil (which will be converted to ""), or a Range (which will be converted to a CSQuery.Range)

Link to this section Types

Link to this type names() View Source
names() :: nil | String.t() | atom()

Valid name types for a CSQuery.FieldValue struct.

Note that CSQuery.Expression.operators/0 are not valid field names as they are reserved keywords in the structured query syntax.

Link to this type t() View Source
t() :: %CSQuery.FieldValue{name: names(), value: values()}

The struct for CSQuery.FieldValue.

Link to this section Functions

Link to this function new(value) View Source
new(t() | map() | values() | Range.t()) :: t()
new(struct()) :: t()
new(%{required(atom() | String.t()) => values() | nil | Range.t()}) ::
  t() | nil
new(values() | nil | Range.t()) :: t()

Provide an unnamed CSQuery.FieldValue struct for the value provided.

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

If the value provided is a map, the first key and value combination will be used to construct the CSQuery.FieldValue struct.

iex> new(%{title: "Star Wars", year: 1990})
%CSQuery.FieldValue{name: :title, value: "Star Wars"}

See new/2 for more information.

Link to this function new(name, value) View Source
new(:and, keyword()) :: CSQuery.Expression.t()
new(:near, keyword()) :: CSQuery.Expression.t()
new(:not, keyword()) :: CSQuery.Expression.t()
new(:or, keyword()) :: CSQuery.Expression.t()
new(:phrase, keyword()) :: CSQuery.Expression.t()
new(:prefix, keyword()) :: CSQuery.Expression.t()
new(:range, keyword()) :: CSQuery.Expression.t()
new(:term, keyword()) :: CSQuery.Expression.t()
new(names(), t()) :: t()
new(names(), values()) :: t()

Provide an optionally named CSQuery.FieldValue struct. The value may be one of values/0, nil (which will be converted to ""), or a Range (which will be converted to a CSQuery.Range).

If a CSQuery.FieldValue struct is provided, a struct with the name replaced will be returned, effectively naming or renaming the field.

iex> new(:plot, %CSQuery.FieldValue{value: "war"})
%CSQuery.FieldValue{name: :plot, value: "war"}

iex> new(:plot, %CSQuery.FieldValue{name: :title, value: "war"})
%CSQuery.FieldValue{name: :plot, value: "war"}

As a special case, when one of the CSQuery.Expression.operators/0 is provided as the name, a CSQuery.Expression will be built inside of a CSQuery.FieldValue struct.

Link to this function to_value(field_value) View Source
to_value(t()) :: String.t()

Convert the CSQuery.FieldValue.t/0 to a string.