mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 08:57:10 -06:00
DEV: Remove the unique_searches column from select query
This commit is contained in:
parent
6080e3a2c0
commit
9c6f77f9da
@ -125,8 +125,7 @@ class SearchLog < ActiveRecord::Base
|
||||
SUM(CASE
|
||||
WHEN search_result_id IS NOT NULL THEN 1
|
||||
ELSE 0
|
||||
END) AS click_through,
|
||||
COUNT(DISTINCT ip_address) AS unique_searches
|
||||
END) AS click_through
|
||||
SQL
|
||||
|
||||
result = SearchLog.select(select_sql)
|
||||
@ -141,7 +140,7 @@ class SearchLog < ActiveRecord::Base
|
||||
end
|
||||
|
||||
result.group('lower(term)')
|
||||
.order('searches DESC, click_through DESC, unique_searches DESC, term ASC')
|
||||
.order('searches DESC, click_through DESC, term ASC')
|
||||
.limit(limit)
|
||||
end
|
||||
|
||||
|
@ -204,7 +204,6 @@ RSpec.describe SearchLog, type: :model do
|
||||
top_trending = SearchLog.trending.first
|
||||
expect(top_trending.term).to eq("ruby")
|
||||
expect(top_trending.searches).to eq(3)
|
||||
expect(top_trending.unique_searches).to eq(2)
|
||||
expect(top_trending.click_through).to eq(0)
|
||||
|
||||
SearchLog.where(term: 'ruby', ip_address: '127.0.0.1').update_all(search_result_id: 12)
|
||||
|
Loading…
Reference in New Issue
Block a user