/** * This method should be used by admin only since the previous searching does not restrict the * visibility according to the logged-in user's google ID. Therefore,This fromResults method does * not require a googleID as a parameter. Returned results bundle will contain information related * to matched instructors only. * * @param results * @return studentResultBundle containing information related to matched students only. */ public InstructorSearchResultBundle getInstructorsfromResults(Results<ScoredDocument> results) { if (results == null) { return this; } cursor = results.getCursor(); for (ScoredDocument doc : results) { InstructorAttributes instructor = JsonUtils.fromJson( doc.getOnlyField(Const.SearchDocumentField.INSTRUCTOR_ATTRIBUTE).getText(), InstructorAttributes.class); if (instructorsLogic.getInstructorForRegistrationKey(StringHelper.encrypt(instructor.key)) == null) { instructorsLogic.deleteDocument(instructor); continue; } instructorList.add(instructor); numberOfResults++; } sortInstructorResultList(); return this; }