private static void addFormatSet(SolrInputDocument doc, Collection<DcsFormat> set) {
    if (set == null || set.size() == 0) {
      return;
    }

    for (DcsFormat fmt : set) {
      setadd(doc, FormatField.NAME, fmt.getName());
      setadd(doc, FormatField.FORMAT, fmt.getFormat());
      setadd(doc, FormatField.SCHEMA, fmt.getSchemeUri());
      setadd(doc, FormatField.VERSION, fmt.getVersion());
    }
  }
  public static SolrInputDocument indexMetadataFile(
      SolrInputDocument doc, Collection<DcsMetadataRef> set, List<SolrInputDocument> docs) {

    int foundFgdc = 0;
    // Assuming the DCS file is available in the Sip
    for (DcsMetadataRef ref : set) {
      DcsFile file = null;
      for (SolrInputDocument document : docs) {
        String refStr = ref.getRef();
        String id = (String) document.getFieldValue(EntityField.ID.solrName());
        if (refStr.equals(id))
          try {
            file = (DcsFile) fromSolr(toSolrDocument(document));
          } catch (IOException e) {
            e
                .printStackTrace(); // To change body of catch statement use File | Settings | File
                                    // Templates.
          }
      }
      if (file == null) continue;
      // get the file from SIP or from index
      //  DcsFile file = new DcsFile();
      for (DcsFormat format : file.getFormats()) {
        if (format.getFormat().contains("fgdc")) {
          MetadataDocument fgdcDoc = null;
          try {
            String fileSource = file.getSource().replace("file://", "");

            fgdcDoc = MetadataDocument.Factory.parse(new File(fileSource));
            ThemeType[] keywords = fgdcDoc.getMetadata().getIdinfo().getKeywords().getThemeArray();
            PlaceType[] places = fgdcDoc.getMetadata().getIdinfo().getKeywords().getPlaceArray();

            Set<String> themes = new HashSet<String>();
            for (ThemeType theme : keywords) {
              for (String themeStr : theme.getThemekeyArray()) themes.add(themeStr);
            }
            addStrings(doc, themes, CoreMetadataField.SUBJECT);

            Set<String> placeKeys = new HashSet<String>();
            for (PlaceType place : places) {
              for (String placeStr : place.getPlacekeyArray()) placeKeys.add(placeStr);
            }
            addStrings(doc, placeKeys, SeadSolrField.DeliverableUnitField.LOCATION);

          } catch (XmlException e) {
            e
                .printStackTrace(); // To change body of catch statement use File | Settings | File
                                    // Templates.
          } catch (IOException e) {
            e
                .printStackTrace(); // To change body of catch statement use File | Settings | File
                                    // Templates.
          }
          foundFgdc = 1;
        }
        if (foundFgdc == 1) break;
      }
      if (foundFgdc == 1) break;
    }
    return doc;
  }