// walk through remaining command-line arguments and
// add each argument as a single to term to a new document.
for (int x = 1; x < args.length; x++) {
String term = args[x];
Document doc = new Document();
doc.addValue(0, term);
doc.addTerm(term);
db.addDocument(doc);
}
// make sure to commit the database so the documents get written to disk
db.commit();