I wrote a small loop which added 10,000 documents into the IndexWriter and it took for ever to do it.
Is there another way to index large volumes of documents?
I ask because when this goes live it has to load in 15,000 records.
The other question is how do I prevent having to load in all the records again when the web application is restarted?
Edit
Here is the code i used;
for (int t = 0; t < 10000; t++){
doc = new Document();
text = "Value" + t.toString();
doc.Add(new Field("Value", text, Field.Store.YES, Field.Index.TOKENIZED));
iwriter.AddDocument(doc);
};
Edit 2
Analyzer analyzer = new StandardAnalyzer();
Directory directory = new RAMDirectory();
IndexWriter iwriter = new IndexWriter(directory, analyzer, true);
iwriter.SetMaxFieldLength(25000);
then the code to add the documents, then;
iwriter.Close();
Just checking, but you haven’t got the debugger attached when you’re running it have you?
This severely affects performance when adding documents.
On my machine (Lucene 2.0.0.4):
Built with platform target x86:
No debugger – 5.2 seconds
Debugger attached – 113.8 seconds
Built with platform target x64:
No debugger – 6.0 seconds
Debugger attached – 171.4 seconds
Rough example of saving and loading an index to and from a RAMDirectory: