Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Lance format Lance Java IndexType

From Leeroopedia


Knowledge Sources
Domains Java_SDK, Indexing
Last Updated 2026-02-08 19:33 GMT

Overview

Description

IndexType is a Java enum in the org.lance.index package that enumerates all supported index types in the Lance format. Each enum constant has an associated integer value matching the Rust representation. The enum covers scalar index types (values 0-9), including SCALAR, BTREE, BITMAP, LABEL_LIST, INVERTED, NGRAM, FRAGMENT_REUSE, MEM_WAL, ZONEMAP, and BLOOM_FILTER, as well as vector index types (values 100+), including VECTOR, IVF_FLAT, IVF_SQ, IVF_PQ, IVF_HNSW_SQ, IVF_HNSW_PQ, and IVF_HNSW_FLAT.

Usage

IndexType is used throughout the Java SDK to classify and select the type of index to create or query. It appears as a required parameter in IndexOptions and as a metadata field in Index.

Code Reference

Source Location

java/src/main/java/org/lance/index/IndexType.java

Signature

public enum IndexType {
    SCALAR(0),
    BTREE(1),
    BITMAP(2),
    LABEL_LIST(3),
    INVERTED(4),
    NGRAM(5),
    FRAGMENT_REUSE(6),
    MEM_WAL(7),
    ZONEMAP(8),
    BLOOM_FILTER(9),
    VECTOR(100),
    IVF_FLAT(101),
    IVF_SQ(102),
    IVF_PQ(103),
    IVF_HNSW_SQ(104),
    IVF_HNSW_PQ(105),
    IVF_HNSW_FLAT(106);

    public int getValue();
}

Import

import org.lance.index.IndexType;

I/O Contract

Enum Values
Constant Integer Value Category Description
SCALAR 0 Scalar Generic scalar index
BTREE 1 Scalar B-Tree index for ordered scalar lookups
BITMAP 2 Scalar Bitmap index for low-cardinality columns
LABEL_LIST 3 Scalar Label list index for multi-label columns
INVERTED 4 Scalar Inverted index for full-text search
NGRAM 5 Scalar N-gram index for substring matching
FRAGMENT_REUSE 6 Scalar Fragment reuse index
MEM_WAL 7 Scalar Memory WAL index
ZONEMAP 8 Scalar Zone map index for range filtering
BLOOM_FILTER 9 Scalar Bloom filter index for membership queries
VECTOR 100 Vector Generic vector index
IVF_FLAT 101 Vector IVF with flat (uncompressed) storage
IVF_SQ 102 Vector IVF with scalar quantization
IVF_PQ 103 Vector IVF with product quantization
IVF_HNSW_SQ 104 Vector IVF + HNSW graph with scalar quantization
IVF_HNSW_PQ 105 Vector IVF + HNSW graph with product quantization
IVF_HNSW_FLAT 106 Vector IVF + HNSW graph with flat storage

Usage Examples

import org.lance.index.IndexType;

// Check the integer value of an index type
IndexType type = IndexType.IVF_PQ;
System.out.println("IVF_PQ value: " + type.getValue()); // 103

// Use in index creation
IndexOptions options = IndexOptions.builder(
    Arrays.asList("embedding"), IndexType.IVF_HNSW_SQ, params
).build();

// Compare index types from metadata
Index idx = ...;
if (idx.indexType() == IndexType.BTREE) {
    System.out.println("This is a B-Tree index");
}

Related Pages

  • Index - Uses IndexType as a metadata field
  • IndexOptions - Requires IndexType to specify which index to create
  • DistanceType - Distance metric enum used alongside vector index types

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment