lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maik Schreiber <blizzy-keyword-lucene_dev.656...@blizzy.de>
Subject Contribution: LuceneIndexAccessor
Date Mon, 16 May 2005 16:11:23 GMT
Hi,

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:

http://www.blizzy.de/lucene/lucene-indexaccess-0.1.0.zip


Using LuceneIndexAccessor is incredibly simple:


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

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


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

	// use writer...
} catch (IOException e) {
	// ...
} finally {
	accessor.release(write);
}


// somewhere near program exit
accessor.close();


(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   *   http://www.blizzy.de

GPG public key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x1F11D713
Key fingerprint: CF19 AFCE 6E3D 5443 9599 18B5 5640 1F11 D713

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message