searchjoy 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitattributes +1 -0
- data/CHANGELOG.md +5 -0
- data/README.md +5 -5
- data/lib/generators/searchjoy/templates/install.rb +3 -5
- data/lib/searchjoy.rb +3 -10
- data/lib/searchjoy/track.rb +2 -2
- data/lib/searchjoy/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 251310fe718b7f513e69055ad21cff3c6b172941
|
4
|
+
data.tar.gz: 6c9b95367fb7cf245e797d329f545c25fa3b4190
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b9c9a88f6b774e9854dd5762e96ad13b0e4ddab0d374552fe43f054a923c0ac3d9896636196b2d0d3cc0c24c2698ffc4dadd7fe7b7fb376c9e7c75cdbc5ae2a
|
7
|
+
data.tar.gz: cdeab36645b69149e4807428e59e9d2d04de44616eec9c6740846d42ff874fcd45788c72d8ac47309a4339c901b744810f5c606dcfffae25a0ead18f11f65293
|
data/.gitattributes
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
app/views/* linguist-vendored
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -24,7 +24,7 @@ And run the generator. This creates a migration to store searches.
|
|
24
24
|
|
25
25
|
```sh
|
26
26
|
rails generate searchjoy:install
|
27
|
-
|
27
|
+
rails db:migrate
|
28
28
|
```
|
29
29
|
|
30
30
|
Next, add the dashboard to your `config/routes.rb`.
|
@@ -91,7 +91,7 @@ Don’t forget to protect the dashboard in production.
|
|
91
91
|
In your `config/routes.rb`:
|
92
92
|
|
93
93
|
```ruby
|
94
|
-
authenticate :user, ->
|
94
|
+
authenticate :user, ->(user) { user.admin? } do
|
95
95
|
mount Searchjoy::Engine, at: "searchjoy"
|
96
96
|
end
|
97
97
|
```
|
@@ -122,19 +122,19 @@ Searchjoy.top_searches = 500 # defaults to 100
|
|
122
122
|
Link to the search results [master]
|
123
123
|
|
124
124
|
```ruby
|
125
|
-
Searchjoy.query_url = ->
|
125
|
+
Searchjoy.query_url = ->(search) { Rails.application.routes.url_helpers.items_path(q: search.query) }
|
126
126
|
```
|
127
127
|
|
128
128
|
Add additional info to the query in the live stream.
|
129
129
|
|
130
130
|
```ruby
|
131
|
-
Searchjoy.query_name = ->
|
131
|
+
Searchjoy.query_name = ->(search) { "#{search.query} #{search.city}" }
|
132
132
|
```
|
133
133
|
|
134
134
|
Show the conversion name in the live stream.
|
135
135
|
|
136
136
|
```ruby
|
137
|
-
Searchjoy.conversion_name = ->
|
137
|
+
Searchjoy.conversion_name = ->(model) { model.name }
|
138
138
|
```
|
139
139
|
|
140
140
|
## TODO
|
@@ -1,20 +1,18 @@
|
|
1
1
|
class <%= migration_class_name %> < ActiveRecord::Migration<%= migration_version %>
|
2
2
|
def change
|
3
3
|
create_table :searchjoy_searches do |t|
|
4
|
-
t.
|
4
|
+
t.references :user
|
5
5
|
t.string :search_type
|
6
6
|
t.string :query
|
7
7
|
t.string :normalized_query
|
8
8
|
t.integer :results_count
|
9
9
|
t.timestamp :created_at
|
10
|
-
t.
|
11
|
-
t.string :convertable_type
|
10
|
+
t.references :convertable, polymorphic: true
|
12
11
|
t.timestamp :converted_at
|
13
12
|
end
|
14
13
|
|
15
14
|
add_index :searchjoy_searches, [:created_at]
|
16
15
|
add_index :searchjoy_searches, [:search_type, :created_at]
|
17
|
-
add_index :searchjoy_searches, [:search_type, :normalized_query, :created_at], name: "
|
18
|
-
add_index :searchjoy_searches, [:convertable_id, :convertable_type]
|
16
|
+
add_index :searchjoy_searches, [:search_type, :normalized_query, :created_at], name: "index_searchjoy_searches_on_search_type_query" # autogenerated name is too long
|
19
17
|
end
|
20
18
|
end
|
data/lib/searchjoy.rb
CHANGED
@@ -30,15 +30,8 @@ rescue LoadError
|
|
30
30
|
end
|
31
31
|
|
32
32
|
if defined?(Searchkick)
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
define_method(:execute_without_track, instance_method(:execute))
|
37
|
-
define_method(:execute, instance_method(:execute_with_track))
|
38
|
-
end
|
39
|
-
|
40
|
-
class Results
|
41
|
-
attr_accessor :search
|
42
|
-
end
|
33
|
+
Searchkick::Query.prepend(Searchjoy::Track)
|
34
|
+
class Searchkick::Results
|
35
|
+
attr_accessor :search
|
43
36
|
end
|
44
37
|
end
|
data/lib/searchjoy/track.rb
CHANGED
data/lib/searchjoy/version.rb
CHANGED
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.3.
|
4
|
+
version: 0.3.2
|
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: 2018-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chartkick
|
@@ -101,6 +101,7 @@ executables: []
|
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
|
+
- ".gitattributes"
|
104
105
|
- ".gitignore"
|
105
106
|
- CHANGELOG.md
|
106
107
|
- Gemfile
|
@@ -144,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
145
|
version: '0'
|
145
146
|
requirements: []
|
146
147
|
rubyforge_project:
|
147
|
-
rubygems_version: 2.6.
|
148
|
+
rubygems_version: 2.6.13
|
148
149
|
signing_key:
|
149
150
|
specification_version: 4
|
150
151
|
summary: Search analytics made easy
|