search_controller.rb 387 Bytes
Newer Older
Zac Wood's avatar
Zac Wood committed
1 2
class SearchController < ApplicationController
  def index
Zac Wood's avatar
Zac Wood committed
3
    # sorry zach
Zac Wood's avatar
Zac Wood committed
4
    results = SearchHelper::GenericItem.fetchall(String.new(params[:query]), semester: @semester).group_by(&:type)
Zac Wood's avatar
Zac Wood committed
5 6 7 8

    # results = search(params[:query])
    @instructors = results[:instructor]&.map(&:data)
    @courses = results[:course]&.map(&:data)
Zac Wood's avatar
Zac Wood committed
9
  end
Zac Wood's avatar
Zac Wood committed
10 11 12

  # cases
  # math 113 - [a-zA-Z]{3,} [1-9]{3}
Zac Wood's avatar
Zac Wood committed
13
end