searchjoy 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 718d461a1a5396990820d7317954813740bf68a2
4
- data.tar.gz: 50c91afedfa3db697f0f94d3bab4bb9911a08355
3
+ metadata.gz: 1b5b37420e741afe05925396f8b0b80ea561ae1b
4
+ data.tar.gz: 54799f92c58b23b70520f1ce02edf1e950992b22
5
5
  SHA512:
6
- metadata.gz: 57c03a406ab8d0e6b75fdbda81b519ab02d6b9d00c3a079b32540b6fd6e1e92d6467201db9334733f18fbca3153b46d6f46d0899795426540d5696f32f1a429b
7
- data.tar.gz: e1a65b650370a3d47458edba0380b7cb2e10795d511da052231d548359db6829d6a1bcb8558a4567421126005b91a8e4c164e0743441e5343421436dcaca690e
6
+ metadata.gz: 6dbb2d7291d0378747674ee6a8d2bc5ab0915fa6bed0958845818406f83b58dfddd7766bfed084c4ed85c62c2b384bcecbfab3e2410a052fb95773b7ac524dd7
7
+ data.tar.gz: 7908a81eec008402c9c61392f5e5a17387297da415302f846bc5742f8a17c34c5c15fbfb7bc1f527f48dcce307d9842eb4e20eebd3bb4b763c78f661916053cc
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 0.2.0
2
+
3
+ - Fixed error with Rails 5
4
+ - Fixed `Index name too long` error with SQLite
5
+ - Added `query_name` option
6
+ - Removed support for Rails 3
7
+
1
8
  ## 0.1.0
2
9
 
3
10
  - Fixed Searchkick integration for `execute: false`
data/README.md CHANGED
@@ -12,8 +12,6 @@ Works with any search platform, including Elasticsearch, Sphinx, and Solr
12
12
 
13
13
  :cupid: An amazing companion to [Searchkick](https://github.com/ankane/searchkick)
14
14
 
15
- :tangerine: Battle-tested at [Instacart](https://www.instacart.com/opensource)
16
-
17
15
  ## Get Started
18
16
 
19
17
  Add this line to your application’s Gemfile:
@@ -32,7 +30,7 @@ rake db:migrate
32
30
  Next, add the dashboard to your `config/routes.rb`.
33
31
 
34
32
  ```ruby
35
- mount Searchjoy::Engine, at: "admin/searchjoy"
33
+ mount Searchjoy::Engine, at: "searchjoy"
36
34
  ```
37
35
 
38
36
  Be sure to protect the endpoint in production - see the [Authentication](#authentication) section for ways to do this.
@@ -88,44 +86,44 @@ search.convert(item)
88
86
 
89
87
  Don’t forget to protect the dashboard in production.
90
88
 
91
- #### Basic Authentication
89
+ #### Devise
92
90
 
93
- Set the following variables in your environment or an initializer.
91
+ In your `config/routes.rb`:
94
92
 
95
93
  ```ruby
96
- ENV["SEARCHJOY_USERNAME"] = "andrew"
97
- ENV["SEARCHJOY_PASSWORD"] = "secret"
94
+ authenticate :user, -> (user) { user.admin? } do
95
+ mount Searchjoy::Engine, at: "searchjoy"
96
+ end
98
97
  ```
99
98
 
100
- #### Devise
99
+ #### Basic Authentication
101
100
 
102
- In your `config/routes.rb`:
101
+ Set the following variables in your environment or an initializer.
103
102
 
104
103
  ```ruby
105
- authenticate :user, -> (user) { user.admin? } do
106
- mount Searchjoy::Engine, at: "admin/searchjoy"
107
- end
104
+ ENV["SEARCHJOY_USERNAME"] = "andrew"
105
+ ENV["SEARCHJOY_PASSWORD"] = "secret"
108
106
  ```
109
107
 
110
108
  ### Customize
111
109
 
112
- #### Time Zone
113
-
114
110
  To change the time zone, create an initializer `config/initializers/searchjoy.rb` with:
115
111
 
116
112
  ```ruby
117
113
  Searchjoy.time_zone = "Pacific Time (US & Canada)" # defaults to Time.zone
118
114
  ```
119
115
 
120
- #### Top Searches
121
-
122
116
  Change the number of top searches shown with:
123
117
 
124
118
  ```ruby
125
119
  Searchjoy.top_searches = 500 # defaults to 100
126
120
  ```
127
121
 
128
- #### Live Conversions
122
+ Add additional info to the query in the live stream. [master]
123
+
124
+ ```ruby
125
+ Searchjoy.query_name = -> (search) { "#{search.query} #{search.city}" }
126
+ ```
129
127
 
130
128
  Show the conversion name in the live stream.
131
129
 
@@ -4,11 +4,11 @@ module Searchjoy
4
4
 
5
5
  http_basic_authenticate_with name: ENV["SEARCHJOY_USERNAME"], password: ENV["SEARCHJOY_PASSWORD"] if ENV["SEARCHJOY_PASSWORD"]
6
6
 
7
- before_filter :set_time_zone
8
- before_filter :set_search_types
9
- before_filter :set_search_type, only: [:index, :overview]
10
- before_filter :set_time_range, only: [:index, :overview]
11
- before_filter :set_searches, only: [:index, :overview]
7
+ before_action :set_time_zone
8
+ before_action :set_search_types
9
+ before_action :set_search_type, only: [:index, :overview]
10
+ before_action :set_time_range, only: [:index, :overview]
11
+ before_action :set_searches, only: [:index, :overview]
12
12
 
13
13
  def index
14
14
  if params[:sort] == "conversion_rate"
@@ -7,9 +7,9 @@
7
7
  <thead>
8
8
  <tr>
9
9
  <th>Query</th>
10
- <th class="num" style="width: 20%;"><%= link_to "Searches", params.except(:sort), class: ("active" if params[:sort] != "conversion_rate") %></th>
10
+ <th class="num" style="width: 20%;"><%= link_to "Searches", searches_path(search_type: params[:search_type]), class: ("active" if params[:sort] != "conversion_rate") %></th>
11
11
  <th class="num" style="width: 20%;">Conversions</th>
12
- <th class="num" style="width: 20%;"><%= link_to "%", params.merge(sort: "conversion_rate"), class: ("active" if params[:sort] == "conversion_rate") %></th>
12
+ <th class="num" style="width: 20%;"><%= link_to "%", searches_path(search_type: params[:search_type], sort: "conversion_rate"), class: ("active" if params[:sort] == "conversion_rate") %></th>
13
13
  <th class="num" style="width: 20%;">Avg Results</th>
14
14
  </tr>
15
15
  </thead>
@@ -3,7 +3,8 @@
3
3
  <td style="width: 15%;">
4
4
  <%= link_to search.search_type, overview_searches_path(search_type: search.search_type), class: "type-link type-link-#{@search_types.index(search.search_type)}" %>
5
5
  </td>
6
- <td><%= search.query %></td>
6
+ <td><%= Searchjoy.query_name ? Searchjoy.query_name.call(search) : search.query %></td>
7
+
7
8
  <td style="width: 35%; color: #5cb85c;">
8
9
  <% if search.converted_at %>
9
10
  <strong>✓</strong>
@@ -14,7 +14,7 @@ class <%= migration_class_name %> < ActiveRecord::Migration
14
14
 
15
15
  add_index :searchjoy_searches, [:created_at]
16
16
  add_index :searchjoy_searches, [:search_type, :created_at]
17
- add_index :searchjoy_searches, [:search_type, :normalized_query, :created_at], name: "index_searchjoy_searches_on_search_type_and_normalized_query_an" # autogenerated name is too long
17
+ add_index :searchjoy_searches, [:search_type, :normalized_query, :created_at], name: "index_searchjoy_searches_on_search_type_normalized_query" # autogenerated name is too long
18
18
  add_index :searchjoy_searches, [:convertable_id, :convertable_type]
19
19
  end
20
20
  end
data/lib/searchjoy.rb CHANGED
@@ -19,6 +19,7 @@ module Searchjoy
19
19
 
20
20
  # conversion name
21
21
  mattr_accessor :conversion_name
22
+ mattr_accessor :query_name
22
23
  end
23
24
 
24
25
  begin
@@ -1,3 +1,3 @@
1
1
  module Searchjoy
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
data/searchjoy.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_dependency "chartkick"
22
22
  spec.add_dependency "groupdate"
23
- spec.add_dependency "activerecord"
23
+ spec.add_dependency "activerecord", ">= 4"
24
24
 
25
25
  spec.add_development_dependency "bundler"
26
26
  spec.add_development_dependency "rake"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: searchjoy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-24 00:00:00.000000000 Z
11
+ date: 2017-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chartkick
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '4'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '4'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -144,11 +144,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  version: '0'
145
145
  requirements: []
146
146
  rubyforge_project:
147
- rubygems_version: 2.6.1
147
+ rubygems_version: 2.5.1
148
148
  signing_key:
149
149
  specification_version: 4
150
150
  summary: Search analytics made easy
151
151
  test_files:
152
152
  - test/searchjoy_test.rb
153
153
  - test/test_helper.rb
154
- has_rdoc: