Hui v0.5.0 Hui.Q View Source

Struct and functions related to standard and common request parameters.

These correspond to the default query parser known as the lucene parser for structured queries, as well as the common parameters such as as sorting and pagination parameters (rows, sort, start etc).

See below for more details:

Link to this section Summary

Types

t()

Use this struct to specify standard and common request parameters

Functions

Encodes t:Hui.Q.t/0, t:Hui.F.t/0 structs into a query string

Link to this section Types

Link to this type t() View Source
t() :: %Hui.Q{
  cache: boolean(),
  debug: binary(),
  debugQuery: boolean(),
  defType: binary(),
  df: binary(),
  echoParams: binary(),
  explainOther: binary(),
  facet: Hui.F.t(),
  fl: binary(),
  fq: binary() | [binary()],
  logParamsList: term(),
  omitHeader: boolean(),
  q: binary(),
  "q.op": binary(),
  rows: integer(),
  segmentTerminateEarly: boolean(),
  sort: binary(),
  sow: boolean(),
  start: number(),
  timeAllowed: number(),
  wt: binary()
}

Use this struct to specify standard and common request parameters.

Example

iex> %Hui.Q{q: "edinburgh", fl: "id,title", fq: ["type:image"], rows: 15}
%Hui.Q{
  cache: nil,
  debug: nil,
  debugQuery: nil,
  defType: nil,
  df: nil,
  echoParams: nil,
  explainOther: nil,
  facet: nil,
  fl: "id,title",
  fq: ["type:image"],
  logParamsList: nil,
  omitHeader: nil,
  q: "edinburgh",
  "q.op": nil,
  rows: 15,
  segmentTerminateEarly: nil,
  sort: nil,
  sow: nil,
  start: nil,
  timeAllowed: nil,
  wt: nil
}

Link to this section Functions

Link to this function encode_query(query_struct) View Source

Encodes t:Hui.Q.t/0, t:Hui.F.t/0 structs into a query string.

Example

iex> x = %Hui.Q{q: "edinburgh", fl: "id,title", fq: ["type:image"], rows: 15}
%Hui.Q{
  cache: nil,
  debug: nil,
  debugQuery: nil,
  defType: nil,
  df: nil,
  echoParams: nil,
  explainOther: nil,
  facet: nil,
  fl: "id,title",
  fq: ["type:image"],
  logParamsList: nil,
  omitHeader: nil,
  q: "edinburgh",
  "q.op": nil,
  rows: 15,
  segmentTerminateEarly: nil,
  sort: nil,
  sow: nil,
  start: nil,
  timeAllowed: nil,
  wt: nil
}
iex> x |> Hui.Q.encode_query
"fl=id%2Ctitle&fq=type%3Aimage&q=edinburgh&rows=15"