lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Samuel Jackson <samurujack...@yahoo.de>
Subject Indexing problem - empty index files!
Date Mon, 24 Oct 2005 23:33:44 GMT
Hi to all!

I'm new to Lucene and wanted to create a sample
application to index certain database fields.

But there seems to be some problem because the created
files in the index target directory are only 1kb -->
So I don't get any results of course.


Here is what I did - can anyone give me a hint whats
wrong?

for (Iterator iter = someData.iterator();
iter.hasNext(); ) { 
Item item = (Item) iter.next();
Document doc = new Document();
doc.add(Field.Text("id", 
Long.toString(item.getId())));
doc.add(Field.Text("title", item.getTitle()));
doc.add(Field.Text("description", item.getTitle()));
try {
        final IndexWriter writer = new
IndexWriter(indexLocation, new StandardAnalyzer(),
true);
        writer.addDocument(doc);
        writer.optimize();
        writer.close();
        indexCreated = true;
}
catch (IOException e) {
    e.printStackTrace();
}
}






	

	
		
___________________________________________________________ 
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de

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


Mime
View raw message