# Changelog

## 0.4.2

- Refactor `TestHelpers.reset_facets_artifacts`. The function now takes a config as first argument.

## 0.4.1

- Improve identity column type validation.
- Added benchmark.

## 0.4.0

### Breaking change

#### Joins per facet

Joins are now configured per facet, instead of once at the top level.
Each facet carries its own `joins` chain from the source to the table its value comes from.

This removes a previous limitation: with a single top-level `joins` list, every faceted joined column had to lie on one shared path. Facets can now fetch data from independent relations.
For example, over a `articles` source table, one facet joining to `authors` and another joining through `article_categories` to `categories`.

**Migration:** 

Move each `joins` list from the top level into the facet that uses it.

If several facets shared one top-level `joins`, give each facet the portion of the chain up to its own `join_table`.

**Before**

```elixir
%{
  facets_table: "authors_facets",
  source_table: "authors",
  facets: [
    %{
      facet_name: "role_name",
      join_table: "roles",
      value_column: "name"
    }
  ],
  joins: [
    %{table: "roles", match: "roles.id", to: "authors.role_id"}
  ]
}
```

**After**

```elixir
%{
  facets_table: "authors_facets",
  source_table: "authors",
  facets: [
    %{
      facet_name: "role_name",
      join_table: "roles",
      value_column: "name",
      joins: [
        %{table: "roles", match: "roles.id", to: "authors.role_id"}
      ]
    }
  ]
}
```

### Internal

Trigger logic has moved to separate helper library [Sublimate ➚](https://hex.pm/packages/sublimate).

## 0.3.0

### Search updates

- Adds search option `order_by`. This includes support for mult-column sorting and null-ordering directions.
- Breaking changes:
  - The search option `facets` now accepts a string-keyed map instead of an atom-keyed map.
    This enables search options to be created directly from external sources, such as URL parameters,
    without converting string keys to atoms first.
  - Similarly, the search option `result_fields` now accepts a list of strings instead of a list of atoms.

[Searching](./doc_pages/faceted_search.md)

### Flop adapter

Adds a Flop adapter for using [Flop ➚](https://hex.pm/packages/flop) with Refine.

The adapter translates Flop parameters into a Refine faceted search:
Flop provides filtering, ordering, and pagination, while Refine provides the facets.
This is useful when you already use Flop for searching and want to add faceting to existing queries.

[Flop adapter](./doc_pages/flop_adapter.md)

## 0.2.0

Facets can now be created from [joined tables](https://refine.hexdocs.pm/joins_configuration.html)

## 0.1.0

Initial implementation.
