class MobileAppApi::V1::SearchController

Public Instance Methods

search_categories() click to toggle source

Method to get categories according to search parameters.

# File app/controllers/mobile_app_api/v1/search_controller.rb, line 47
def search_categories
  categories = Category.search(query: params[:query]).records
  render json: { status: 200, search_count: categories.total_count, categories: categories.records }
end
search_students() click to toggle source

Method to get students according to search parameters.

# File app/controllers/mobile_app_api/v1/search_controller.rb, line 37
def search_students
  students = Student.search(query: params[:query]).records
  render json: {
    status: 200,
    search_count: students.total_count,
    students: students.records.map(&:full_info)
  }
end
search_service_providers() click to toggle source

Method to search all service providers.

# File app/controllers/mobile_app_api/v1/search_controller.rb, line 5
def search_service_providers
  tutors = Tutor.search(query: params[:query]).records
  render json: { status: 200, search_count: tutors.total_count, service_providers: tutors.records.map(&:full_info), category_subjects_courses: tutors.records.map(&:categories_subjects_courses)}
end
search_courses() click to toggle source

Method to get courses according to search parameters.

# File app/controllers/mobile_app_api/v1/search_controller.rb, line 11
def search_courses
  courses = Course.search(query: params[:query]).records
  render json: { status: 200, search_count: courses.total_count, courses: courses.records }
end
search_subjects() click to toggle source

Method to get subjects according to search parameters.

# File app/controllers/mobile_app_api/v1/search_controller.rb, line 53
def search_subjects
  subjects = Subject.search(query: params[:query]).records
  render json: { status: 200, search_count: subjects.total_count, subjects: subjects.records }
end