@Override public Field[] createDescriptorFields(BufferedImage image) { docsCreated = true; LinkedList<Field> resultList = new LinkedList<Field>(); if (builders.size() >= 1) { for (DocumentBuilder builder : builders) { Field[] fields = builder.createDescriptorFields(image); for (int i = 0; i < fields.length; i++) { resultList.add(fields[i]); } } } return resultList.toArray(new Field[resultList.size()]); }
public Document createDocument(BufferedImage image, String identifier) throws FileNotFoundException { docsCreated = true; Document doc = new Document(); if (identifier != null) doc.add( new StringField( DocumentBuilder.FIELD_NAME_IDENTIFIER, identifier, Field.Store .YES)); // changed to StringField based on the suggestions of Berthold Daum // <*****@*****.**> if (builders.size() >= 1) { for (DocumentBuilder builder : builders) { Field[] fields = builder.createDescriptorFields(image); for (int i = 0; i < fields.length; i++) { Field field = fields[i]; doc.add(field); } } } return doc; }