datalevin

2025-05-16T07:10:35.203509Z

Hi everyone! After attempt to migrate from 0.9.20 to 0.9.22 I got such error on compiling:

Execution error (UnsatisfiedLinkError) at jdk.internal.loader.NativeLibraries/load (NativeLibraries.java:-2).
/root/.javacpp/cache/dtlvnative-linux-arm64-0.12.8.jar/datalevin/dtlvnative/linux-arm64/libjniDTLV.so: libmvec.so.1: cannot open shared object file: No such file or directory
Had anyone else encountered it? Any ideas how to solve?

2025-05-16T10:11:15.046479Z

Thank you. That is it

πŸ‘ 1
Akiz 2025-05-16T09:22:20.221029Z

Hi, I want to do vector search with Datalevin. This query works fine (defn find-similar-code "Find top-k code snippets most similar to the query embedding." [db query-embedding top-k] (let [neighbors (d/q '[:find ?filename ?ns ?name ?text :in $ ?query-vec ?k :where [(vec-neighbors $ :code/embedding ?query-vec {:top ?k}) [[?entity-id ?a ?embedding-vector]]] [?entity-id :code/filename ?filename] [?entity-id :code/ns ?ns] [?entity-id :code/name ?name] [?entity-id :code/text ?text]] db query-embedding top-k)] neighbors)) But i would like to get distances as well, after adding :display :refs+dists I can’t make the query work. It fails with Execution error (ClassCastException) at datalevin.datom/datom (datom.clj:58). class clojure.lang.PersistentVector cannot be cast to class java.lang.Number (clojure.lang.PersistentVector is in unnamed module of loader 'app'; java.lang.Number is in module java.base of loader 'bootstrap') Any ideas how should I update the query? I can’t find any example.

Huahai 2025-05-16T16:25:18.075499Z

This is probably an oversight on my part, we need to destruct the result of :refs+dists for Datalog. Thank you for reporting.

πŸ‘ 1
Huahai 2025-05-16T16:27:07.658059Z

https://github.com/juji-io/datalevin/issues/327

2025-05-16T12:50:30.817399Z

Problem with docker-datalevin: docker-compose.yaml:

services:

  ...more services...

  datalevin:
    image: huahaiy/datalevin
    container_name: datalevin
    ports:
      - "8898:8898"
    volumes:
      - ./docker/datalevin-data:/data
    networks:
      - app-network
    restart: unless-stopped

networks:
  app-network:
    driver: bridge
On backend I use connection string <database-name> . Everything works, even if I stop everything with Ctrl-C and restart with docker compose up then data persists despite in ./docker/datalevin-data folder is only system subfolder. But if I do docker compose up --build or docker compose up --force-recreate then no data from previous session persists. Maybe someone know the root of this problem?

Huahai 2025-05-16T18:01:12.281109Z

Deepseek says that this is expected. "Yes, this behavior can be expected depending on how your Docker Compose setup is configured. Here's why: Key Issue: Volume Behavior on Rebuild/Recreate When you use --build or --force-recreate, Docker Compose may create new containers from fresh images, but the behavior of your volumes depends on your configuration:"

Huahai 2025-05-16T18:01:54.506579Z

Why Your Data Disappears β€’ If you're using anonymous volumes or haven't defined volumes explicitly, Docker may create new ones on rebuild/recreate, discarding old data. β€’ Some database images (like PostgreSQL, MySQL) automatically create anonymous volumes if you don't specify one.

Huahai 2025-05-16T18:02:25.179239Z

How to Fix It 1. Use Named Volumes (recommended): 2. yaml 3. 4. Copy 5. Download 6. services: 7. db: 8. image: postgres 9. volumes: 10. - db_data:/var/lib/postgresql/data 11. volumes: 12. db_data: # Add this at the root level

Huahai 2025-05-16T18:03:22.409299Z

so the fix is to add a volumes section in your yaml file and define your volumes there

πŸ‘Œ 1
2025-05-16T19:31:57.503829Z

Thank you! Will try tomorrow