Skip to main content
Apache Lucene is the industry-standard Java library for building powerful search applications. It gives you the primitives to index documents, analyze text, and execute expressive queries — all with exceptional performance at any scale.

Quickstart

Index your first documents and run your first search in minutes.

Core Concepts

Understand indexes, documents, fields, queries, and the analysis pipeline.

Indexing

Learn how to build and update an index with documents and fields.

Searching

Execute queries, rank results, and sort and paginate hits.

Modules

Explore optional modules: query parser, faceting, highlighting, suggest, and vector search.

Migration Guide

Upgrading from an older Lucene version? See what changed.

What is Lucene?

Lucene is a Java library — not a server, not a service. You embed it directly in your application to add full-text search. It handles:
  • Indexing: turning raw text (and numeric, geo, or vector data) into an efficient inverted index on disk
  • Analysis: tokenizing, lowercasing, stemming, and filtering text at index and query time
  • Searching: matching queries against the index and ranking results by relevance
  • Extensibility: pluggable codecs, analyzers, similarities, and merge policies
Products like Elasticsearch and Apache Solr are built on top of Lucene.

Key capabilities

Full-text search

Boolean, phrase, fuzzy, wildcard, and range queries over analyzed text fields.

Vector search

KNN/HNSW approximate nearest-neighbor search for semantic and AI-powered retrieval.

Faceting

Drill-down navigation with counts, ranges, and taxonomy hierarchies.

Geo-spatial

Lat/lon point, distance, and polygon queries for location-aware search.

Highlighting

Highlight matched terms in result snippets with the Unified Highlighter.

Autocomplete

Prefix, infix, and fuzzy completion with ranked suggestions.

Get started in four steps

1

Add Lucene to your project

Add the lucene-core artifact (and optional module JARs) to your build system.
2

Create an index

Open a Directory, configure an IndexWriter, and add Document objects.
3

Search the index

Open a DirectoryReader, wrap it in an IndexSearcher, and execute a Query.
4

Process results

Iterate over TopDocs, load stored fields, and apply highlighting or faceting.

Build docs developers (and LLMs) love