View Source Paradex
Ecto fragments for ParadeDB versions 0.11.x - 0.13.x
.
Installation
Add :paradex
to your list of dependencies in mix.exs
:
def deps do
[
{:paradex, "~> 0.3.2"}
]
end
Documentation is available on HexDocs and may also be generated with ExDoc.
Usage
You may install ParadeDB via Docker, or by loading the extensions into an existing Postgres database.
Create lib/postgrex_types.ex
with the contents below. You may omit Pgvector.extensions()
if you aren't working with vectors:
Postgrex.Types.define(
ParadexApp.PostgrexTypes,
Pgvector.extensions() ++ Paradex.extensions() ++ Ecto.Adapters.Postgres.extensions(),
[]
)
Add the following to config/config.exs
:
config :my_app, MyApp.Repo, types: MyApp.PostgrexTypes
Create your Ecto schema and a search index in your migrations.
Once complete, you're ready to run search queries:
import Ecto.Query
import Paradex
alias MyApp.Call
alias MyApp.Repo
from(
c in Call,
where: c.transcript ~> "bus"
)
|> Repo.all()
More examples are available in the API docs.