lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Tucker" <MTuc...@infoimage.com>
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);
	writer.close();

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)));
			
	writer.addDocument(doc);
	is.close();

	writer.close();


I get the following new files:

	deletable
	_1.f1
	_1.fdt
	_1.fdx
	_1.fnm
	_1.frq
	_1.prx
	_1.tii
	_1.tis


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.

Mark

--
To unsubscribe, e-mail:   <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>


Mime
View raw message