private static void addMetadataSet(SolrInputDocument doc, Collection<DcsMetadata> set) throws IOException { if (set == null || set.size() == 0) { return; } for (DcsMetadata md : set) { setadd(doc, MetadataField.SCHEMA, md.getSchemaUri()); setadd(doc, MetadataField.TEXT, md.getMetadata()); if (md.getMetadata() == null) { continue; } try { Reader in = new StringReader(md.getMetadata()); addXml(doc, "ext_", MetadataField.SEARCH_TEXT.solrName(), new InputSource(in)); in.close(); // Index FGDC String metadata = md.getMetadata(); if (metadata.contains("<metadata>")) // fgdc - change the check { FgdcMapping mapping = new FgdcMapping(); Map<Enum, String> fgdcElements = mapping.map(metadata); Iterator it = fgdcElements.entrySet().iterator(); while (it.hasNext()) { Map.Entry pair = (Map.Entry) it.next(); add(doc, (SeadSolrField.FgdcField) pair.getKey(), pair.getValue()); it.remove(); // avoids a ConcurrentModificationException } } in.close(); } catch (SAXException e) { throw new IOException(e); } } }