'Search for a notes by user id, course_id and usage_id.'

def _search(self):

    search_with_usage_id = False
    user = self.get_params.get('user', None)
    usage_ids = self.get_params.get('usage_id', [])
    course_id = self.get_params.get('course_id', None)
    text = self.get_params.get('text', None)
    page = int(self.get_params.get('page', 1))
    page_size = int(self.get_params.get('page_size', 2))
    if (user is None):
        self.respond(400, 'Bad    Request')
        return
    notes = self.server.get_all_notes()
    if (course_id is not None):
        notes = self.server.filter_by_course_id(notes, course_id)
    if (len(usage_ids) > 0):
        search_with_usage_id = True
        notes = self.server.filter_by_usage_id(notes, usage_ids)
    if text:
        notes = self.server.search(notes, text)
    if (not search_with_usage_id):
        notes = self._get_paginated_response(notes, page, page_size)
    self.respond(content=notes)
