View Source Haystack.Query.Expression behaviour (Haystack v0.1.0)

A module for defining query expressions.

Link to this section Summary

Callbacks

Evaluate the given clause.

Functions

Build the expression into a statement.

Return the default expressions.

Create a new expression.

Link to this section Types

@type k() :: atom()
@type t() :: %Haystack.Query.Expression{field: String.t(), k: k(), term: String.t()}

Link to this section Callbacks

@callback evaluate(Haystack.Index.t(), t()) :: [map()]

Evaluate the given clause.

Link to this section Functions

@spec build(t()) :: Haystack.Query.statement()

Build the expression into a statement.

examples

Examples

iex> expression = Query.Expression.new(:match, field: "name", term: "Haystack")
iex> Query.Expression.build(expression)
@spec default() :: [{atom(), module()}]

Return the default expressions.

examples

Examples

iex> Query.Expression.default()
@spec new(k(), Keyword.t()) :: t()

Create a new expression.

examples

Examples

iex> Query.Expression.new(:match, field: "name", term: "Haystack")