View Source ExTypesense

Hex.pm Hexdocs.pm Hex.pm

Typesense client for Elixir with support for importing your Ecto schemas.

todo

TODO:

  • [x] ~import ecto schemas to propagate collections/documents~
  • [ ] pre-defined schema and fields
  • [ ] creating collection using auto schema detection
  • [x] ~implement search~
  • [ ] implement multisearch
  • [ ] implement geosearch
  • [ ] implement curation
  • [ ] implement synonyms

local-typesense-server

local typesense server

docker container run --rm -it -d --name typesense -e TYPESENSE_DATA_DIR=/data -e TYPESENSE_API_KEY=xyz -v /tmp/typesense-server-data:/data -p 8108:8108 typesense/typesense:0.23.1

installation

Installation

If available in Hex, the package can be installed by adding ex_typesense to your list of dependencies in mix.exs:

def deps do
  [
    {:ex_typesense, "~> 0.2.2"}
  ]
end

Config for setting up api key, host, etc.

You can find this in your dashboard if you're using cloud-hosted Typesense

config :ex_typesense,
  api_key: "xyz",
  host: "localhost", # "111222333aaabbbcc-9.x9.typesense.net"
  port: 8108, # 443
  scheme: "http" # "https"

Then:

  1. create collection (lib/ex_typesense/collection.ex)
  2. index a document (lib/ex_typesense/document.ex)
  3. try to search (lib/ex_typesense/document.ex)

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/ex_typesense.