Packages
search_core
0.1.0
Multilingual full-text search building blocks for plain Elixir/Ecto: a stemming text pipeline and Postgres tsvector/tsquery helpers. No Ash required.
Current section
Files
Jump to
Current section
Files
lib/search_core.ex
defmodule SearchCore do
@moduledoc """
Multilingual full-text search building blocks for plain Elixir/Ecto — no Ash required.
Two responsibilities:
* `SearchCore.Pipeline` — turn raw text into normalized, stemmed tokens
(via the `Stemmers` Rust NIF, French and the full Snowball set included).
* `SearchCore.Tsvector` — turn those tokens into the `search_text` you index and
the `tsquery` you search with, both from the *same* pipeline so index and query
never drift apart.
This module is a thin facade over those two. See `SearchCore.Tsvector` for the
Postgres wiring (`to_tsvector('simple', …)` / `to_tsquery('simple', …)`).
iex> SearchCore.searchable_text("Les chevaux mangent", :french)
"cheval mangent"
iex> SearchCore.tsquery("chevaux", :french)
"cheval"
"""
defdelegate process(text, lang, opts \\ []), to: SearchCore.Pipeline
defdelegate searchable_text(text, lang, opts \\ []), to: SearchCore.Tsvector
defdelegate tsquery(query, lang, opts \\ []), to: SearchCore.Tsvector
end