View Source Haystack.Index.Field (Haystack v0.1.0)
A module for index fields.
This module allows you to configure the fields of the index. Each field can have a customised set of transformers and a custom regex used for tokenizing.
Link to this section Summary
Link to this section Types
@type k() :: String.t()
Link to this section Functions
Create a new field.
You can include nested fields using dot syntax. The field accepts an optional list of transformers to be used as well as a regex used for tokenizing.
examples
Examples
iex> field = Index.Field.new("name")
iex> field.k
"name"
iex> field = Index.Field.new("address.line_1")
iex> field.path
["address", "line_1"]
Create a new "term" field.
A term field is a field that shouldn't be tokenized or transformed. For example, an ID, serial code, etc.
examples
Examples
iex> field = Index.Field.term("id")
iex> field.transformers
[]