View Source Paradex
Ecto fragments for ParadeDB versions 0.11.x - 0.15.1. Refer to the table below for compatability:
| ParadeDB version | Paradex version |
|---|---|
0.11.0 - 0.14.1 | 0.3.3 |
0.15.x | 0.4.x |
Installation
Add :paradex to your list of dependencies in mix.exs:
def deps do
[
{:paradex, "~> 0.4.0"}
]
endDocumentation 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.PostgrexTypesCreate 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.