Search in sources :

Example 1 with InstructorSearchDocument

use of teammates.storage.search.InstructorSearchDocument 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)

Aggregations

ArrayList (java.util.ArrayList)1 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)1 InstructorSearchDocument (teammates.storage.search.InstructorSearchDocument)1 SearchDocument (teammates.storage.search.SearchDocument)1