Search in sources :

Example 1 with FeedbackResponseCommentSearchDocument

use of teammates.storage.search.FeedbackResponseCommentSearchDocument in project teammates by TEAMMATES.

the class DataMigrationForFeedbackResponseCommentSearchDocument method postAction.

/**
 * {@inheritDoc}
 */
@Override
protected void postAction() {
    if (isPreview()) {
        return;
    }
    LoopHelper loopHelper = new LoopHelper(BATCH_SIZE, "documents processed.");
    List<Document> documentsToUpdate = new ArrayList<>();
    for (FeedbackResponseCommentAttributes comment : commentsToMigrate) {
        loopHelper.recordLoop();
        documentsToUpdate.add(new FeedbackResponseCommentSearchDocument(comment).build());
        if (documentsToUpdate.size() == BATCH_SIZE) {
            updateAndClearDocuments(documentsToUpdate);
        }
    }
    updateAndClearDocuments(documentsToUpdate);
}
Also used : FeedbackResponseCommentSearchDocument(teammates.storage.search.FeedbackResponseCommentSearchDocument) FeedbackResponseCommentAttributes(teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes) LoopHelper(teammates.client.scripts.util.LoopHelper) ArrayList(java.util.ArrayList) Document(com.google.appengine.api.search.Document) FeedbackResponseCommentSearchDocument(teammates.storage.search.FeedbackResponseCommentSearchDocument)

Example 2 with FeedbackResponseCommentSearchDocument

use of teammates.storage.search.FeedbackResponseCommentSearchDocument in project teammates by TEAMMATES.

the class FeedbackResponseCommentsDb method putDocuments.

/*
     * Batch creates or updates search documents for the given comments
     */
public void putDocuments(List<FeedbackResponseCommentAttributes> comments) {
    List<SearchDocument> frcSearchDocuments = new ArrayList<>();
    for (FeedbackResponseCommentAttributes comment : comments) {
        frcSearchDocuments.add(new FeedbackResponseCommentSearchDocument(comment));
    }
    putDocuments(Const.SearchIndex.FEEDBACK_RESPONSE_COMMENT, frcSearchDocuments);
}
Also used : FeedbackResponseCommentSearchDocument(teammates.storage.search.FeedbackResponseCommentSearchDocument) FeedbackResponseCommentAttributes(teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes) ArrayList(java.util.ArrayList) SearchDocument(teammates.storage.search.SearchDocument) FeedbackResponseCommentSearchDocument(teammates.storage.search.FeedbackResponseCommentSearchDocument)

Aggregations

ArrayList (java.util.ArrayList)2 FeedbackResponseCommentAttributes (teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes)2 FeedbackResponseCommentSearchDocument (teammates.storage.search.FeedbackResponseCommentSearchDocument)2 Document (com.google.appengine.api.search.Document)1 LoopHelper (teammates.client.scripts.util.LoopHelper)1 SearchDocument (teammates.storage.search.SearchDocument)1