View Source Indexed.Actions.CreateView (Indexed v0.3.4)

Create a view - a custom result set prefilter.

Link to this section Summary

Functions

Build a view for a particular set of search results, indexed by the :fields config on index, identified by fingerprint.

Link to this section Functions

Link to this function

run(index, entity_name, fingerprint, opts \\ [])

View Source
@spec run(Indexed.t(), atom(), Indexed.View.fingerprint(), keyword()) ::
  {:ok, Indexed.View.t()} | :error

Build a view for a particular set of search results, indexed by the :fields config on index, identified by fingerprint.

options

Options

  • :filter - Function which takes a record and returns true if it should be included in the result set. This is evaluated after the prefilter. Default is nil where all values will be accepted.
  • :maintain_unique - List of field name atoms for which a list of unique values under the prefilter will be managed. These lists can be fetched via Indexed.get_uniques_list/4 and Indexed.get_uniques_map/4.
  • :params - Keyword list of parameters which were used to generate the fingerprint. If provided, they will be added to the %Indexed.View{} for use in authorization checking by the depending application.
  • :prefilter - Selects a pre-partitioned section of the full data of entity_name. The filter function will be applied onto this in order to arrive at the view's data set. See Indexed.prefilter/0.