2016-02-12 23:52:43 +08:00
|
|
|
class SearchController < ApplicationController
|
2019-07-24 23:39:51 +08:00
|
|
|
include IconsHelper
|
2021-02-05 19:39:26 +08:00
|
|
|
include ProjectFoldersHelper
|
2017-06-28 21:44:18 +08:00
|
|
|
before_action :load_vars, only: :index
|
2016-02-12 23:52:43 +08:00
|
|
|
|
|
|
|
def index
|
2024-03-21 22:56:35 +08:00
|
|
|
respond_to do |format|
|
|
|
|
format.html do
|
|
|
|
redirect_to new_search_path unless @search_query
|
|
|
|
end
|
|
|
|
format.json do
|
|
|
|
redirect_to new_search_path unless @search_query
|
|
|
|
|
2024-03-22 23:37:59 +08:00
|
|
|
case params[:group]
|
|
|
|
when 'projects'
|
2024-03-26 23:42:36 +08:00
|
|
|
@project_search_count = fetch_cached_count(Project)
|
2024-03-22 23:37:59 +08:00
|
|
|
search_projects
|
|
|
|
if params[:preview] == 'true'
|
2024-03-26 23:42:36 +08:00
|
|
|
results = @project_results&.limit(4) || []
|
2024-03-22 23:37:59 +08:00
|
|
|
else
|
|
|
|
results = @project_results.page(params[:page]).per(Constants::SEARCH_LIMIT)
|
|
|
|
end
|
|
|
|
|
2024-03-27 18:44:52 +08:00
|
|
|
render json: results.includes(:team, :project_folder),
|
2024-03-22 23:37:59 +08:00
|
|
|
each_serializer: GlobalSearch::ProjectSerializer,
|
|
|
|
meta: {
|
|
|
|
total: @search_count,
|
|
|
|
next_page: (results.next_page if results.respond_to?(:next_page)),
|
|
|
|
}
|
2024-03-27 18:44:52 +08:00
|
|
|
when 'project_folders'
|
|
|
|
@project_folder_search_count = fetch_cached_count ProjectFolder
|
|
|
|
search_project_folders
|
|
|
|
results = if params[:preview] == 'true'
|
|
|
|
@project_folder_results.limit(Constants::GLOBAL_SEARCH_PREVIEW_LIMIT)
|
|
|
|
else
|
|
|
|
@project_folder_results.page(params[:page]).per(Constants::SEARCH_LIMIT)
|
|
|
|
end
|
|
|
|
render json: results.includes(:team, :parent_folder),
|
|
|
|
each_serializer: GlobalSearch::ProjectFolderSerializer,
|
|
|
|
meta: {
|
|
|
|
total: @search_count,
|
|
|
|
next_page: results.try(:next_page)
|
|
|
|
}
|
2024-03-22 23:37:59 +08:00
|
|
|
return
|
2024-03-29 15:34:13 +08:00
|
|
|
when 'experiments'
|
|
|
|
@experiment_search_count = fetch_cached_count Experiment
|
|
|
|
search_experiments
|
|
|
|
results = if params[:preview] == 'true'
|
|
|
|
@experiment_results.limit(Constants::GLOBAL_SEARCH_PREVIEW_LIMIT)
|
|
|
|
else
|
|
|
|
@experiment_results.page(params[:page]).per(Constants::SEARCH_LIMIT)
|
|
|
|
end
|
|
|
|
render json: results.includes(project: :team),
|
|
|
|
each_serializer: GlobalSearch::ExperimentSerializer,
|
|
|
|
meta: {
|
|
|
|
total: @search_count,
|
|
|
|
next_page: results.try(:next_page)
|
|
|
|
}
|
|
|
|
return
|
2024-03-26 23:42:36 +08:00
|
|
|
when 'protocols'
|
|
|
|
@protocol_search_count = fetch_cached_count(Protocol)
|
|
|
|
search_protocols
|
|
|
|
results = if params[:preview] == 'true'
|
|
|
|
@protocol_results&.limit(4) || []
|
|
|
|
else
|
|
|
|
@protocol_results.page(params[:page]).per(Constants::SEARCH_LIMIT)
|
|
|
|
end
|
|
|
|
|
|
|
|
render json: results,
|
|
|
|
each_serializer: GlobalSearch::ProtocolSerializer,
|
|
|
|
meta: {
|
|
|
|
total: @search_count,
|
|
|
|
next_page: (results.next_page if results.respond_to?(:next_page)),
|
|
|
|
}
|
|
|
|
return
|
2024-04-03 06:55:09 +08:00
|
|
|
when 'repository_rows'
|
|
|
|
@repository_row_search_count = fetch_cached_count(RepositoryRow)
|
|
|
|
search_repository_rows
|
|
|
|
results = if params[:preview] == 'true'
|
|
|
|
@repository_row_results.take(4)
|
|
|
|
else
|
|
|
|
@repository_row_results.page(params[:page]).per(Constants::SEARCH_LIMIT)
|
|
|
|
end
|
|
|
|
|
|
|
|
render json: results,
|
|
|
|
each_serializer: GlobalSearch::RepositoryRowSerializer,
|
|
|
|
meta: {
|
|
|
|
total: @search_count,
|
|
|
|
next_page: (results.next_page if results.respond_to?(:next_page))
|
|
|
|
}
|
|
|
|
return
|
2024-03-21 22:56:35 +08:00
|
|
|
end
|
2024-03-22 23:37:59 +08:00
|
|
|
|
|
|
|
#@search_id = params[:search_id] ? params[:search_id] : generate_search_id
|
|
|
|
#
|
|
|
|
#count_search_results
|
|
|
|
#
|
|
|
|
#search_projects if @search_category == :projects
|
|
|
|
#search_project_folders if @search_category == :project_folders
|
|
|
|
#search_experiments if @search_category == :experiments
|
|
|
|
#search_modules if @search_category == :modules
|
|
|
|
#search_results if @search_category == :results
|
|
|
|
#search_tags if @search_category == :tags
|
|
|
|
#search_reports if @search_category == :reports
|
|
|
|
#search_protocols if @search_category == :protocols
|
|
|
|
#search_steps if @search_category == :steps
|
|
|
|
#search_checklists if @search_category == :checklists
|
|
|
|
#if @search_category == :repositories && params[:repository]
|
|
|
|
# search_repository
|
|
|
|
#end
|
|
|
|
#search_assets if @search_category == :assets
|
|
|
|
#search_tables if @search_category == :tables
|
|
|
|
#search_comments if @search_category == :comments
|
|
|
|
|
|
|
|
#@search_pages = (@search_count.to_f / Constants::SEARCH_LIMIT.to_f).ceil
|
|
|
|
#@start_page = @search_page - 2
|
|
|
|
#@start_page = 1 if @start_page < 1
|
|
|
|
#@end_page = @start_page + 4
|
|
|
|
|
|
|
|
#if @end_page > @search_pages
|
|
|
|
# @end_page = @search_pages
|
|
|
|
# @start_page = @end_page - 4
|
|
|
|
# @start_page = 1 if @start_page < 1
|
|
|
|
#end
|
2024-03-21 22:56:35 +08:00
|
|
|
end
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def new
|
|
|
|
end
|
|
|
|
|
2024-02-23 21:08:51 +08:00
|
|
|
def quick
|
|
|
|
results = [
|
|
|
|
Project.first,
|
|
|
|
Experiment.first,
|
|
|
|
MyModule.first,
|
|
|
|
Protocol.first,
|
|
|
|
RepositoryRow.first,
|
|
|
|
Result.first,
|
|
|
|
Step.first,
|
|
|
|
Report.first,
|
|
|
|
LabelTemplate.first
|
|
|
|
].compact
|
|
|
|
|
|
|
|
render json: results, each_serializer: QuickSearchSerializer
|
|
|
|
end
|
|
|
|
|
2016-02-12 23:52:43 +08:00
|
|
|
private
|
|
|
|
|
|
|
|
def load_vars
|
2017-05-09 00:00:14 +08:00
|
|
|
query = (params.fetch(:q) { '' }).strip
|
2016-02-12 23:52:43 +08:00
|
|
|
@search_category = params[:category] || ''
|
|
|
|
@search_category = @search_category.to_sym
|
|
|
|
@search_page = params[:page].to_i || 1
|
2017-05-05 22:41:23 +08:00
|
|
|
@search_case = params[:match_case] == 'true'
|
|
|
|
@search_whole_word = params[:whole_word] == 'true'
|
|
|
|
@search_whole_phrase = params[:whole_phrase] == 'true'
|
|
|
|
@display_query = query
|
|
|
|
|
|
|
|
if @search_whole_phrase || query.count(' ').zero?
|
|
|
|
if query.length < Constants::NAME_MIN_LENGTH
|
|
|
|
flash[:error] = t('general.query.length_too_short',
|
|
|
|
min_length: Constants::NAME_MIN_LENGTH)
|
2017-12-08 00:59:23 +08:00
|
|
|
redirect_back(fallback_location: root_path)
|
2017-05-05 22:41:23 +08:00
|
|
|
elsif query.length > Constants::TEXT_MAX_LENGTH
|
|
|
|
flash[:error] = t('general.query.length_too_long',
|
|
|
|
max_length: Constants::TEXT_MAX_LENGTH)
|
2017-12-08 00:59:23 +08:00
|
|
|
redirect_back(fallback_location: root_path)
|
2017-05-05 22:41:23 +08:00
|
|
|
else
|
|
|
|
@search_query = query
|
|
|
|
end
|
|
|
|
else
|
|
|
|
# splits the search query to validate all entries
|
|
|
|
splited_query = query.split
|
2016-08-02 17:16:07 +08:00
|
|
|
@search_query = ''
|
2017-05-05 22:41:23 +08:00
|
|
|
splited_query.each_with_index do |w, i|
|
|
|
|
if w.length >= Constants::NAME_MIN_LENGTH &&
|
|
|
|
w.length <= Constants::TEXT_MAX_LENGTH
|
|
|
|
@search_query += "#{splited_query[i]} "
|
2016-10-05 23:45:20 +08:00
|
|
|
end
|
2016-07-29 22:32:54 +08:00
|
|
|
end
|
2021-07-23 17:56:28 +08:00
|
|
|
if @search_query.blank?
|
2017-05-05 22:41:23 +08:00
|
|
|
flash[:error] = t('general.query.wrong_query',
|
|
|
|
min_length: Constants::NAME_MIN_LENGTH,
|
|
|
|
max_length: Constants::TEXT_MAX_LENGTH)
|
2017-12-08 00:59:23 +08:00
|
|
|
redirect_back(fallback_location: root_path)
|
2017-05-05 22:41:23 +08:00
|
|
|
else
|
|
|
|
@search_query.strip!
|
|
|
|
end
|
2016-07-21 19:11:15 +08:00
|
|
|
end
|
2016-08-18 19:14:31 +08:00
|
|
|
@search_page = 1 if @search_page < 1
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|
2016-07-26 16:55:27 +08:00
|
|
|
|
2016-02-12 23:52:43 +08:00
|
|
|
protected
|
|
|
|
|
2018-03-26 19:19:09 +08:00
|
|
|
def generate_search_id
|
|
|
|
SecureRandom.urlsafe_base64(32)
|
|
|
|
end
|
|
|
|
|
2016-02-12 23:52:43 +08:00
|
|
|
def search_by_name(model)
|
2017-05-05 22:41:23 +08:00
|
|
|
model.search(current_user,
|
|
|
|
true,
|
|
|
|
@search_query,
|
|
|
|
@search_page,
|
|
|
|
nil,
|
|
|
|
match_case: @search_case,
|
|
|
|
whole_word: @search_whole_word,
|
|
|
|
whole_phrase: @search_whole_phrase)
|
2022-03-28 15:56:39 +08:00
|
|
|
.order(created_at: :desc)
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def count_by_name(model)
|
2017-05-17 15:08:40 +08:00
|
|
|
model.search(current_user,
|
|
|
|
true,
|
|
|
|
@search_query,
|
|
|
|
Constants::SEARCH_NO_LIMIT,
|
|
|
|
nil,
|
|
|
|
match_case: @search_case,
|
|
|
|
whole_word: @search_whole_word,
|
|
|
|
whole_phrase: @search_whole_phrase).size
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|
|
|
|
|
2017-06-23 22:06:11 +08:00
|
|
|
def count_by_repository
|
2018-03-26 19:19:09 +08:00
|
|
|
@repository_search_count =
|
|
|
|
Rails.cache.fetch("#{@search_id}/repository_search_count",
|
|
|
|
expires_in: 5.minutes) do
|
|
|
|
search_count = {}
|
|
|
|
search_results = Repository.search(current_user,
|
|
|
|
@search_query,
|
|
|
|
Constants::SEARCH_NO_LIMIT,
|
|
|
|
nil,
|
|
|
|
match_case: @search_case,
|
|
|
|
whole_word: @search_whole_word,
|
|
|
|
whole_phrase: @search_whole_phrase)
|
|
|
|
|
|
|
|
current_user.teams.includes(:repositories).each do |team|
|
|
|
|
team_results = {}
|
2019-09-10 17:20:18 +08:00
|
|
|
team_results[:team] = team
|
2018-03-26 19:19:09 +08:00
|
|
|
team_results[:count] = 0
|
|
|
|
team_results[:repositories] = {}
|
2019-07-24 23:39:51 +08:00
|
|
|
Repository.accessible_by_teams(team).each do |repository|
|
2018-03-26 19:19:09 +08:00
|
|
|
repository_results = {}
|
|
|
|
repository_results[:id] = repository.id
|
2019-09-10 17:20:18 +08:00
|
|
|
repository_results[:repository] = repository
|
2018-03-26 19:19:09 +08:00
|
|
|
repository_results[:count] = 0
|
|
|
|
search_results.each do |result|
|
2020-01-16 22:30:19 +08:00
|
|
|
repository_results[:count] += result.counter if repository.id == result.id
|
2018-03-26 19:19:09 +08:00
|
|
|
end
|
|
|
|
team_results[:repositories][repository.name] = repository_results
|
|
|
|
team_results[:count] += repository_results[:count]
|
2017-06-23 22:06:11 +08:00
|
|
|
end
|
2018-03-26 19:19:09 +08:00
|
|
|
search_count[team.name] = team_results
|
2017-06-23 22:06:11 +08:00
|
|
|
end
|
2018-03-26 19:19:09 +08:00
|
|
|
search_count
|
2017-06-23 22:06:11 +08:00
|
|
|
end
|
2018-03-26 19:19:09 +08:00
|
|
|
|
|
|
|
count_total = 0
|
|
|
|
@repository_search_count.each_value do |team_results|
|
|
|
|
count_total += team_results[:count]
|
2017-06-23 22:06:11 +08:00
|
|
|
end
|
2017-06-27 19:23:51 +08:00
|
|
|
count_total
|
2017-06-23 22:06:11 +08:00
|
|
|
end
|
|
|
|
|
2018-05-15 23:48:48 +08:00
|
|
|
def current_repository_search_count
|
|
|
|
@repository_search_count.each_value do |counter|
|
|
|
|
res = counter[:repositories].values.detect do |rep|
|
|
|
|
rep[:id] == @repository.id
|
|
|
|
end
|
2018-05-24 23:14:40 +08:00
|
|
|
return res[:count] if res && res[:count]
|
2018-05-15 23:48:48 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-02-12 23:52:43 +08:00
|
|
|
def count_search_results
|
2018-03-26 19:19:09 +08:00
|
|
|
@project_search_count = fetch_cached_count Project
|
2020-11-10 22:04:35 +08:00
|
|
|
@project_folder_search_count = fetch_cached_count ProjectFolder
|
2018-03-26 19:19:09 +08:00
|
|
|
@experiment_search_count = fetch_cached_count Experiment
|
|
|
|
@module_search_count = fetch_cached_count MyModule
|
|
|
|
@result_search_count = fetch_cached_count Result
|
|
|
|
@tag_search_count = fetch_cached_count Tag
|
|
|
|
@report_search_count = fetch_cached_count Report
|
|
|
|
@protocol_search_count = fetch_cached_count Protocol
|
|
|
|
@step_search_count = fetch_cached_count Step
|
|
|
|
@checklist_search_count = fetch_cached_count Checklist
|
2017-06-27 19:23:51 +08:00
|
|
|
@repository_search_count_total = count_by_repository
|
2018-03-26 19:19:09 +08:00
|
|
|
@asset_search_count = fetch_cached_count Asset
|
|
|
|
@table_search_count = fetch_cached_count Table
|
|
|
|
@comment_search_count = fetch_cached_count Comment
|
2016-02-12 23:52:43 +08:00
|
|
|
|
|
|
|
@search_results_count = @project_search_count
|
2020-11-10 22:04:35 +08:00
|
|
|
@search_results_count += @project_folder_search_count
|
2016-07-26 16:55:27 +08:00
|
|
|
@search_results_count += @experiment_search_count
|
2016-07-21 19:11:15 +08:00
|
|
|
@search_results_count += @module_search_count
|
|
|
|
@search_results_count += @result_search_count
|
2016-02-12 23:52:43 +08:00
|
|
|
@search_results_count += @tag_search_count
|
2016-07-21 19:11:15 +08:00
|
|
|
@search_results_count += @report_search_count
|
|
|
|
@search_results_count += @protocol_search_count
|
2016-02-12 23:52:43 +08:00
|
|
|
@search_results_count += @step_search_count
|
2016-07-21 19:11:15 +08:00
|
|
|
@search_results_count += @checklist_search_count
|
2017-06-23 22:06:11 +08:00
|
|
|
@search_results_count += @repository_search_count_total
|
2016-07-21 19:11:15 +08:00
|
|
|
@search_results_count += @asset_search_count
|
|
|
|
@search_results_count += @table_search_count
|
2016-02-12 23:52:43 +08:00
|
|
|
@search_results_count += @comment_search_count
|
|
|
|
end
|
|
|
|
|
2018-03-26 19:19:09 +08:00
|
|
|
def fetch_cached_count(type)
|
|
|
|
exp = 5.minutes
|
|
|
|
Rails.cache.fetch(
|
|
|
|
"#{@search_id}/#{type.name.underscore}_search_count", expires_in: exp
|
|
|
|
) do
|
|
|
|
count_by_name type
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-02-12 23:52:43 +08:00
|
|
|
def search_projects
|
2024-03-27 18:44:52 +08:00
|
|
|
@project_results = Project.none
|
2020-11-10 22:04:35 +08:00
|
|
|
@project_results = search_by_name(Project) if @project_search_count.positive?
|
2016-02-12 23:52:43 +08:00
|
|
|
@search_count = @project_search_count
|
|
|
|
end
|
|
|
|
|
2020-11-10 22:04:35 +08:00
|
|
|
def search_project_folders
|
2024-03-27 18:44:52 +08:00
|
|
|
@project_folder_results = ProjectFolder.none
|
2020-11-10 22:04:35 +08:00
|
|
|
@project_folder_results = search_by_name(ProjectFolder) if @project_folder_search_count.positive?
|
|
|
|
@search_count = @project_folder_search_count
|
|
|
|
end
|
|
|
|
|
2016-07-26 16:55:27 +08:00
|
|
|
def search_experiments
|
2024-03-29 15:34:13 +08:00
|
|
|
@experiment_results = Experiment.none
|
2020-11-10 22:04:35 +08:00
|
|
|
@experiment_results = search_by_name(Experiment) if @experiment_search_count.positive?
|
2016-07-26 16:55:27 +08:00
|
|
|
@search_count = @experiment_search_count
|
|
|
|
end
|
|
|
|
|
2016-02-12 23:52:43 +08:00
|
|
|
def search_modules
|
|
|
|
@module_results = []
|
2020-11-10 22:04:35 +08:00
|
|
|
@module_results = search_by_name(MyModule) if @module_search_count.positive?
|
2016-02-12 23:52:43 +08:00
|
|
|
@search_count = @module_search_count
|
|
|
|
end
|
|
|
|
|
2016-07-21 19:11:15 +08:00
|
|
|
def search_results
|
|
|
|
@result_results = []
|
2020-11-10 22:04:35 +08:00
|
|
|
@result_results = search_by_name(Result) if @result_search_count.positive?
|
2016-07-21 19:11:15 +08:00
|
|
|
@search_count = @result_search_count
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def search_tags
|
|
|
|
@tag_results = []
|
2020-11-10 22:04:35 +08:00
|
|
|
@tag_results = search_by_name(Tag) if @tag_search_count.positive?
|
2016-02-12 23:52:43 +08:00
|
|
|
@search_count = @tag_search_count
|
|
|
|
end
|
|
|
|
|
2016-07-21 19:11:15 +08:00
|
|
|
def search_reports
|
|
|
|
@report_results = []
|
2020-11-10 22:04:35 +08:00
|
|
|
@report_results = search_by_name(Report) if @report_search_count.positive?
|
2016-07-21 19:11:15 +08:00
|
|
|
@search_count = @report_search_count
|
|
|
|
end
|
|
|
|
|
|
|
|
def search_protocols
|
|
|
|
@protocol_results = []
|
2020-11-10 22:04:35 +08:00
|
|
|
@protocol_results = search_by_name(Protocol) if @protocol_search_count.positive?
|
2016-07-21 19:11:15 +08:00
|
|
|
@search_count = @protocol_search_count
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def search_steps
|
|
|
|
@step_results = []
|
2020-11-10 22:04:35 +08:00
|
|
|
@step_results = search_by_name(Step) if @step_search_count.positive?
|
2016-02-12 23:52:43 +08:00
|
|
|
@search_count = @step_search_count
|
|
|
|
end
|
|
|
|
|
2016-07-21 19:11:15 +08:00
|
|
|
def search_checklists
|
|
|
|
@checklist_results = []
|
2020-11-10 22:04:35 +08:00
|
|
|
@checklist_results = search_by_name(Checklist) if @checklist_search_count.positive?
|
2016-07-21 19:11:15 +08:00
|
|
|
@search_count = @checklist_search_count
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|
|
|
|
|
2017-06-23 22:06:11 +08:00
|
|
|
def search_repository
|
2020-11-10 22:04:35 +08:00
|
|
|
@repository = Repository.find_by(id: params[:repository])
|
2020-08-11 23:00:36 +08:00
|
|
|
unless current_user.teams.include?(@repository.team) || @repository.private_shared_with?(current_user.teams)
|
|
|
|
render_403
|
|
|
|
end
|
2017-06-23 22:06:11 +08:00
|
|
|
@repository_results = []
|
2020-11-10 22:04:35 +08:00
|
|
|
if @repository_search_count_total.positive?
|
2017-06-23 22:06:11 +08:00
|
|
|
@repository_results =
|
2018-03-09 18:05:43 +08:00
|
|
|
Repository.search(current_user, @search_query, @search_page,
|
|
|
|
@repository,
|
|
|
|
match_case: @search_case,
|
|
|
|
whole_word: @search_whole_word,
|
|
|
|
whole_phrase: @search_whole_phrase)
|
2017-06-23 22:06:11 +08:00
|
|
|
end
|
2018-05-15 23:48:48 +08:00
|
|
|
@search_count = current_repository_search_count
|
2017-06-23 22:06:11 +08:00
|
|
|
end
|
|
|
|
|
2024-04-03 06:55:09 +08:00
|
|
|
def search_repository_rows
|
|
|
|
@repository_row_results = []
|
|
|
|
@repository_row_results = search_by_name(RepositoryRow) if @repository_row_search_count.positive?
|
|
|
|
@search_count = @repository_row_search_count
|
|
|
|
end
|
|
|
|
|
2016-07-21 19:11:15 +08:00
|
|
|
def search_assets
|
|
|
|
@asset_results = []
|
2020-11-10 22:04:35 +08:00
|
|
|
@asset_results = search_by_name(Asset) if @asset_search_count.positive?
|
2016-07-21 19:11:15 +08:00
|
|
|
@search_count = @asset_search_count
|
|
|
|
end
|
|
|
|
|
|
|
|
def search_tables
|
|
|
|
@table_results = []
|
2020-11-10 22:04:35 +08:00
|
|
|
@table_results = search_by_name(Table) if @table_search_count.positive?
|
2016-07-21 19:11:15 +08:00
|
|
|
@search_count = @table_search_count
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def search_comments
|
|
|
|
@comment_results = []
|
2020-11-10 22:04:35 +08:00
|
|
|
@comment_results = search_by_name(Comment) if @comment_search_count.positive?
|
2016-02-12 23:52:43 +08:00
|
|
|
@search_count = @comment_search_count
|
|
|
|
end
|
|
|
|
end
|