lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Tucker" <>
Subject Indexes: locks, files, file contents
Date Tue, 12 Feb 2002 00:01:34 GMT
When creating a new empty index:

	IndexWriter writer = new IndexWriter("myindex", null, true);

Both a write.lock and commit.lock is obtained.  

1.  What is the purpose of this double locking?
2.  When else is write.lock and commit.lock used? 
3.  Any other locks used?

What I am looking for are some simple statements about locks.  For example:
	a. When creating or adding documents to an index a write.lock is always obtained.
	b. The commit.lock is used when ...

After the creation of an empty index, the directory contains a single "segments" file which
is 8 bytes long.  The first four bytes contain a counter used in naming segments, the second
four bytes contains an integer indicating how many segment's summary information is stored
in the segments file.

4.  Why keep a separate counter and size variables?
5.  Is there a max number of segment infos whose summary (name and document count) is stored
in the segments file?

When I then add a document to the index...

	String filePath = "C:\\mydocs\\fox.txt";
	IndexWriter writer = new IndexWriter("myindex", new StopAnalyzer(), false);
	InputStream is = new FileInputStream(filePath);
	Document doc = new Document();
	doc.add(Field.UnIndexed("path", filePath));
	doc.add(Field.Text("body", (Reader) new InputStreamReader(is)));


I get the following new files:


6.  What is the content and format of each of these files?
7.  What if I open another IndexWriter and write a second document to the index and then close
the IndexWriter?  What files will be added or modified?
8.  What happens when I then open an IndexWriter and optimize the index and then close the
writer?  What files will be added or modified?

Thanks for your help.


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

View raw message