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 +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +15 -17
- data/app/controllers/searchjoy/searches_controller.rb +5 -5
- data/app/views/searchjoy/searches/index.html.erb +2 -2
- data/app/views/searchjoy/searches/recent.html.erb +2 -1
- data/lib/generators/searchjoy/templates/install.rb +1 -1
- data/lib/searchjoy.rb +1 -0
- data/lib/searchjoy/version.rb +1 -1
- data/searchjoy.gemspec +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b5b37420e741afe05925396f8b0b80ea561ae1b
|
4
|
+
data.tar.gz: 54799f92c58b23b70520f1ce02edf1e950992b22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6dbb2d7291d0378747674ee6a8d2bc5ab0915fa6bed0958845818406f83b58dfddd7766bfed084c4ed85c62c2b384bcecbfab3e2410a052fb95773b7ac524dd7
|
7
|
+
data.tar.gz: 7908a81eec008402c9c61392f5e5a17387297da415302f846bc5742f8a17c34c5c15fbfb7bc1f527f48dcce307d9842eb4e20eebd3bb4b763c78f661916053cc
|
data/CHANGELOG.md
CHANGED
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: "
|
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
|
-
####
|
89
|
+
#### Devise
|
92
90
|
|
93
|
-
|
91
|
+
In your `config/routes.rb`:
|
94
92
|
|
95
93
|
```ruby
|
96
|
-
|
97
|
-
|
94
|
+
authenticate :user, -> (user) { user.admin? } do
|
95
|
+
mount Searchjoy::Engine, at: "searchjoy"
|
96
|
+
end
|
98
97
|
```
|
99
98
|
|
100
|
-
####
|
99
|
+
#### Basic Authentication
|
101
100
|
|
102
|
-
|
101
|
+
Set the following variables in your environment or an initializer.
|
103
102
|
|
104
103
|
```ruby
|
105
|
-
|
106
|
-
|
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
|
-
|
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
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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",
|
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
|
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: "
|
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
data/lib/searchjoy/version.rb
CHANGED
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.
|
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:
|
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: '
|
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: '
|
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.
|
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:
|