Skip to content

Indexing

Call create_index() after adding a batch of documents:

await client.create_index()

lnclite always creates a tag index. For small document sets, vector search may stay brute-force because exact search is fast and avoids vector index training overhead.

Choose vector search preference when constructing the client:

client = await Lnclite.new(
    lancedb_path="outputs/demo.lance",
    openai_embeddings_model=embeddings,
    model_settings=ModelSettings(dimensions=1536),
    vector_search_prefer="balanced",
)

Available preferences are storage, balanced, accuracy, and latency.

Inspect the recommendation without creating an index:

plan = await client.documents.index_plan()

print(plan.row_count)
print(plan.vector_index_kind)
print(plan.should_create_vector_index)