public void indexDocuments(List<Document> docs){
  IndexWriter writer=getWriter();
  for (  Document document : docs) {
    try {
      writer.addDocument(document);
    }
 catch (    Exception e) {
      e.printStackTrace();
      closeWriter(writer);
      throw new RuntimeException(e);
    }
  }
  closeWriter(writer);
}

public void indexDocuments ( List < Document > docs ) { IndexWriter writer = getWriter ( ) ; for ( Document document : docs ) { try { writer . addDocument ( document ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; closeWriter ( writer ) ; throw new RuntimeException ( e ) ; } } closeWriter ( writer ) ; }
indexes a list of documents .
