lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Add Document constructor?
Date Sun, 28 Sep 2003 23:25:56 GMT
Are there any objections to adding a constructor to Document to take a 
Field[]?

   public Document(Field[] fields) {
     // any other optimizations needed here?
     for (int i = 0; i < fields.length; i++) {
       add(fields[i]);
     }
   }


It would make test code a lot cleaner at least:

     Document doc = new Document();
     doc.add(Field.Text("contents", "fuzzy"));
     writer.addDocument(doc);
     doc = new Document();
     doc.add(Field.Text("contents", "wuzzy"));
     writer.addDocument(doc);

reduced to:

	writer.addDocument(new Document(new Field[] {Field.Text("contents", 
"fuzzy"),
                                                 Field.Text("contents", 
"wuzzy")}));


Thanks,
	Erik


Mime
View raw message