Search in sources :

Example 1 with SearchDocument

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

the class InstructorsDb method putDocuments.

/**
 * Batch creates or updates documents for the given instructors.
 */
public void putDocuments(List<InstructorAttributes> instructorParams) {
    List<SearchDocument> instructorDocuments = new ArrayList<>();
    for (InstructorAttributes instructor : instructorParams) {
        if (instructor.key == null) {
            instructor = this.getInstructorForEmail(instructor.courseId, instructor.email);
        }
        // defensive coding for legacy data
        if (instructor.key != null) {
            instructorDocuments.add(new InstructorSearchDocument(instructor));
        }
    }
    putDocuments(Const.SearchIndex.INSTRUCTOR, instructorDocuments);
}
Also used : InstructorSearchDocument(teammates.storage.search.InstructorSearchDocument) ArrayList(java.util.ArrayList) SearchDocument(teammates.storage.search.SearchDocument) InstructorSearchDocument(teammates.storage.search.InstructorSearchDocument) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Example 2 with SearchDocument

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

the class StudentsDb method putDocuments.

/**
 * Batch creates or updates search documents for the given students.
 */
public void putDocuments(List<StudentAttributes> students) {
    List<SearchDocument> studentDocuments = new ArrayList<>();
    for (StudentAttributes student : students) {
        studentDocuments.add(new StudentSearchDocument(student));
    }
    putDocuments(Const.SearchIndex.STUDENT, studentDocuments);
}
Also used : ArrayList(java.util.ArrayList) StudentSearchDocument(teammates.storage.search.StudentSearchDocument) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) SearchDocument(teammates.storage.search.SearchDocument) StudentSearchDocument(teammates.storage.search.StudentSearchDocument)

Example 3 with SearchDocument

use of teammates.storage.search.SearchDocument 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)3 SearchDocument (teammates.storage.search.SearchDocument)3 FeedbackResponseCommentAttributes (teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes)1 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)1 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)1 FeedbackResponseCommentSearchDocument (teammates.storage.search.FeedbackResponseCommentSearchDocument)1 InstructorSearchDocument (teammates.storage.search.InstructorSearchDocument)1 StudentSearchDocument (teammates.storage.search.StudentSearchDocument)1