lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maik Schreiber <>
Subject Contribution: LuceneIndexAccessor
Date Mon, 16 May 2005 16:11:23 GMT

My company would like to make the following contribution to Lucene (in
sandbox?) licensed under the Apache License, Version 2.0.

Background: While doing project work on a web-based search engine we have
developed a component called LuceneIndexAccessor. This component provides a
high-level index access interface, that is, it synchronizes read/write
access to a Lucene index. You no longer need to worry about concurrently
opening readers/writers/searchers. The component also does caching where
applicable. Further, it makes sure that all Searchers get closed whenever
you have added a document to the index.

You can download the source here:

Using LuceneIndexAccessor is incredibly simple:

Directory directory = ...
Analyzer analyzer = ...

// somewhere near program start
IIndexAccessProvider accessProvider =
	new IndexAccessProvider(directory, analyzer);
ILuceneIndexAccessor accessor = new LuceneIndexAccessor(accessProvider);;

IndexWriter writer = null;
try {
	writer = accessor.getWriter();

	// use writer...
} catch (IOException e) {
	// ...
} finally {

// somewhere near program exit

(Opening IndexReaders or Searchers follows the same use pattern.)

Right now, the source compiles against a CVS version of Lucene. Also, it
uses Log4J for logging. We're happy with changing that if need arises.

Maik Schreiber   *

GPG public key:
Key fingerprint: CF19 AFCE 6E3D 5443 9599 18B5 5640 1F11 D713

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message