Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cleaning-portalmec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Richard Fernando Heise Ferreira
cleaning-portalmec
Commits
40d8b454
Commit
40d8b454
authored
6 years ago
by
legton
Browse files
Options
Downloads
Patches
Plain Diff
SCRUM#388: Save searched words (with information of whether they had results)
parent
b9d449b3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/controllers/v1/search_controller.rb
+7
-1
7 additions, 1 deletion
app/controllers/v1/search_controller.rb
db/migrate/20190313143808_add_has_results_column_to_searches.rb
+5
-0
5 additions, 0 deletions
...rate/20190313143808_add_has_results_column_to_searches.rb
with
12 additions
and
1 deletion
app/controllers/v1/search_controller.rb
+
7
−
1
View file @
40d8b454
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
db/migrate/20190313143808_add_has_results_column_to_searches.rb
0 → 100644
+
5
−
0
View file @
40d8b454
class
AddHasResultsColumnToSearches
<
ActiveRecord
::
Migration
[
5.0
]
def
change
add_column
:searches
,
:has_results
,
:boolean
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment