FASTExecuteFunction( String collectionName, ClusterLocation loc, String purpose, Reference<List<Document>> docs) { m_docs = ESPDocumentConverter.convertESPDocs(docs.getValue(), loc); docs.clear(); m_location = loc; m_callback = new ESPCallbackHandler(purpose, m_docs); // Assumption: all docs in this list have the same customer id because they must have been // arranged that way before submission to fast. // m_collectionName = "collection_" + // docs.getValue().get(0).getElement(AbstractEmailParser.CUSTOMER_ID); m_collectionName = collectionName; }
public Map<String, Collection<com.m1.ems.search.document.ContentError>> addIndexData( String collectionName, ClusterLocation loc, Reference<List<Document>> docs) throws IndexException { if (null == docs || CollectionsUtils.isNullOrEmpty(docs.getValue())) { return Collections.emptyMap(); } try { Map<String, Collection<DocumentError>> errors = (new FASTExecuteFunction(collectionName, loc, "add", docs) { public String executeWithFAST(IContentManager fast) throws ContentManagerException { return fast.addContents(getDocs()); } }) .execute(getBatchTimeoutMillis()); return ESPDocumentConverter.convertESPErrorMap(errors); } catch (ContentManagerException e) { throw new IndexException("ContentManagerException", e); } }