Class Zvec

java.lang.Object
org.zvec.binding.Zvec

public final class Zvec extends Object
Top-level entry point for the Zvec Java binding.

Provides library lifecycle (initialize(org.zvec.binding.ConfigData), shutdown()), version information, and collection factory methods.

Typical usage:


 Zvec.initialize(null);
 try (Collection coll = Zvec.createAndOpen("/tmp/mydb", schema, null)) {
     // ...
 }
 Zvec.shutdown();
 
  • Method Details

    • getVersion

      public static String getVersion()
    • getVersionMajor

      public static int getVersionMajor()
    • getVersionMinor

      public static int getVersionMinor()
    • getVersionPatch

      public static int getVersionPatch()
    • checkVersion

      public static boolean checkVersion(int major, int minor, int patch)
    • getIoBackendType

      public static IoBackendType getIoBackendType()
      Get the I/O backend used for DiskAnn disk reads. On Linux zvec selects the first usable backend in this order: io_uring, libaio, pread; macOS uses pread; Windows uses unbuffered overlapped I/O.
    • getIoBackendTypeName

      public static String getIoBackendTypeName(IoBackendType type)
      Returns the human-readable name of the given I/O backend type.
    • getIoBackendDescription

      public static String getIoBackendDescription()
      Human-readable description of the current I/O backend. On Linux with the pread fallback it also explains how to enable an async backend.
    • initialize

      public static void initialize(ConfigData config)
      Initialize the Zvec library. Pass null for default config.

      The jieba FTS tokenizer needs no setup: its default dictionary and HMM model are embedded in the native library (zvec ≥ v0.8.0), so there is nothing to extract or register. An external dictionary can still be selected per field through the analyzer's extra_params.jieba_dict_dir, or process-wide through the ZVEC_JIEBA_DICT_DIR environment variable; the per-field value wins over the environment, which wins over the embedded default.

    • shutdown

      public static void shutdown()
      Shutdown the Zvec library and release all global resources.
    • isInitialized

      public static boolean isInitialized()
      Returns true if the library has been initialized.
    • clearError

      public static void clearError()
      Clear the last error status.
    • createAndOpen

      public static Collection createAndOpen(String path, CollectionSchema schema, CollectionOptions options)
      Create a new collection at the given path and open it.
    • open

      public static Collection open(String path, CollectionOptions options)
      Open an existing collection.