Here's the code I'm using:

        try {

            // Now add the documents to the index
            IndexWriter writer = new IndexWriter(index_loc, new 
StandardAnalyzer(), !index_loc.exists());
            writer.setMaxFieldLength(Integer.MAX_VALUE);

            try {
                for (int i = start;  i < ids.length;  i ++) {
                    docit = build_document_iterator(doc_root_dir, ids[i]);
                    int count = 0;
                    while (docit.hasNext()) {
                        writer.addDocument((Document)(docit.next()));
                        count += 1;
                    }
                    System.out.println("Added " + docit.id + " (" + count + " 
versions)");
                    System.out.flush();
                }
            } finally {
                // And close the index
                System.out.println("Optimizing...");
                writer.optimize();
                writer.close();
            }

        } catch (Exception e) {
            e.printStackTrace(System.err);
        }

Bill

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to