<commit_before>class Job < ActiveRecord::Base
	include Filterable
	#associations
	belongs_to :employer
	has_and_belongs_to_many :categories
	has_and_belongs_to_many :cities

	#validate
	validates :name, presence: true

	# scope
	default_scope -> { order(created_at: :desc) }

	# query by name of job
	scope :job_name, lambda { |name|
		where("jobs.name LIKE '%' || ? || '%'", name)
	}

	#query by categories
	scope :categories, lambda { |categories|<commit_msg>add filter<commit_after>class Job < ActiveRecord::Base
	include Filterable
	#associations
	belongs_to :employer
	has_and_belongs_to_many :categories
	has_and_belongs_to_many :cities

	#validate
	validates :name, presence: true

	# scope
	default_scope -> { order(created_at: :desc) }

	# query by keyword
	scope :keyword, lambda { |keyword|
		joins(:employer)
		.where("jobs.name LIKE '%' || ? || '%' 
						OR employers.name LIKE '%' || ? || '%'", 
						keyword, 
						keyword)
		.distinct
	}

	# query by name of job
	scope :job_name, lambda { |name|
		where("jobs.name LIKE '%' || ? || '%'", name)
	}

	#query by categories
	scope :categories, lambda { |categories|
{'fraction_non_alphanumeric': 0.13085764809902742, 'fraction_numerical': 0.0, 'mean_word_length': 4.2407407407407405, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6153950', 'n_tokens_mistral': 427, 'n_tokens_neox': 389, 'n_words': 96}