Skip to content
Snippets Groups Projects
Commit 40d8b454 authored by legton's avatar legton
Browse files

SCRUM#388: Save searched words (with information of whether they had results)

parent b9d449b3
No related branches found
No related tags found
No related merge requests found
......@@ -27,7 +27,13 @@ class V1::SearchController < ApplicationController
# GET v1/search.json
def index
search = SearchService.instance(@search, current_user).search
save_search()
if ((search.results).empty?)
@search.has_results = false
save_search()
else
@search.has_results = true
save_search()
end
headers['X-Total-Count'] = search.total_count
render json: search.results, status: :ok
......
class AddHasResultsColumnToSearches < ActiveRecord::Migration[5.0]
def change
add_column :searches, :has_results, :boolean
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment