Bombadil is a tiny wrapper around some PostgreSQL search capabilities
It supports exact match through PostgreSQL tsvector(s) and fuzzy search inside
jsonb fields.
An excerpt from the README in the repository about the usage:
alias Bombadil.Ecto.Schema.SearchIndex
iex> Bombadil.index(SearchIndex, payload: %{"book" => "Lord of the Rings"})
:ok
iex> Bombadil.search("Lord of the Rings")
[
%Bombadil.Ecto.Schema.SearchIndex{
__meta__: #Ecto.Schema.Metadata<:loaded, "search_index">,
payload: %{"book" => "Lord of the Rings"},
id: 1
}
]
iex> Bombadil.fuzzy_search(SearchIndex, "lord of the ringz")
[
%Bombadil.Ecto.Schema.SearchIndex{
__meta__: #Ecto.Schema.Metadata<:loaded, "search_index">,
payload: %{"book" => "Lord of the Rings"},
id: 1
}
]
Thank you!