public List<Task> doTaskSearch(String query, int user_id) {
   List<TaskEntry> list = taskEntryRepository.findByTitleOrDescription(query, query);
   List<Task> ret = new ArrayList<>();
   for (TaskEntry entry : list) {
     System.out.println(
         "entry userID = "
             + entry.getUser_id()
             + " required UserID = "
             + Integer.toString(user_id));
     System.out.println(entry.getType());
     String type = entry.getType();
     if ((type.equals("task") || type.equals("taskItem"))
         && entry.getUser_id().equals(Integer.toString(user_id))) {
       if (type.equals("task")) {
         Task task = OrganizerDAO.getTaskByTitle(user_id, entry.getTitle());
         ret.add(task);
       }
       if (type.equals("taskItem")) {
         TaskItem item = OrganizerDAO.getTaskId(Integer.parseInt(entry.getObj_id()));
         Task task = OrganizerDAO.getTaskById(item.getTask_id());
         List<TaskItem> taskList = OrganizerDAO.getTaskItems(task.getId());
         if (taskList != null) {
           task.setTaskList(taskList);
           task.setTaskListSize(taskList.size());
         }
         ret.add(task);
       }
     }
   }
   return ret;
 }
  public void updateSolrRepository() {
    System.out.println("scheduled task");
    if (taskEntryRepository.count() != 0) {
      System.out.println(latestUpdate);
      List<OrganizerSuperClass> tasks = OrganizerDAO.getRecentTasks(latestUpdate);
      System.out.print("new tasks: " + tasks.size() + " ");
      List<OrganizerSuperClass> items = OrganizerDAO.getRecentItems(latestUpdate);
      System.out.print("new items:" + items.size() + " ");
      List<OrganizerSuperClass> comments = OrganizerDAO.getRecentComments(latestUpdate);
      System.out.println("new comments:" + comments.size());

      for (OrganizerSuperClass task : tasks) {
        task.setType("task");
        convertObjectToEntry(task);
        setLatestUpdate(task.getDate_modified());
      }
      for (OrganizerSuperClass item : items) {
        item.setType("taskItem");
        convertObjectToEntry(item);
        setLatestUpdate(item.getDate_modified());
      }
      for (OrganizerSuperClass comment : comments) {
        comment.setType("comment");
        convertObjectToEntry(comment);
        setLatestUpdate(comment.getDate_created());
      }
    }
  }
  private void loadSampleData() {
    if (taskEntryRepository.count() == 0) {

      System.out.println(latestUpdate);
      List<TaskItem> taskItems = OrganizerDAO.getAllTaskItems();
      List<Task> tasks = OrganizerDAO.getAllTasks();
      List<Comment> comments = OrganizerDAO.getAllComments();

      // finds the latest item updated in comments/tasks/taskitems using math.max(a, math.max(b, c))
      long templatestUpdate =
          Math.max(
              taskItems.get(0).getDate_modified().getTime(),
              Math.max(
                  tasks.get(0).getDate_modified().getTime(),
                  comments.get(0).getDate_created().getTime()));
      latestUpdate = new Timestamp(templatestUpdate);
      convertToEntries(taskItems, tasks, comments);
      System.out.println(latestUpdate);
    }
  }