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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e149d7bbe57f78d3d77522a99ebe00c5c9958528
4
- data.tar.gz: 0027be7a3d258f50a9897cd64218b0b4a3843506
3
+ metadata.gz: 251310fe718b7f513e69055ad21cff3c6b172941
4
+ data.tar.gz: 6c9b95367fb7cf245e797d329f545c25fa3b4190
5
5
  SHA512:
6
- metadata.gz: b59164fcca41b33eabcb6eed7e0aa83a738ce818fbb1ac3b9439d04b8847966e2b764d13d328de7a6eead5fe7fbd758521396659e00a9d5e0153d072ae4b4572
7
- data.tar.gz: db768b9ce87fcac0d1921a45b89827930e9ff3dd512b6fa4e01b98b0a3611203f9224cbe1881de4b31adab60cf1bc82947c6a2eb9401169256cd208c28affead
6
+ metadata.gz: 4b9c9a88f6b774e9854dd5762e96ad13b0e4ddab0d374552fe43f054a923c0ac3d9896636196b2d0d3cc0c24c2698ffc4dadd7fe7b7fb376c9e7c75cdbc5ae2a
7
+ data.tar.gz: cdeab36645b69149e4807428e59e9d2d04de44616eec9c6740846d42ff874fcd45788c72d8ac47309a4339c901b744810f5c606dcfffae25a0ead18f11f65293
@@ -0,0 +1 @@
1
+ app/views/* linguist-vendored
@@ -1,3 +1,8 @@
1
+ ## 0.3.2
2
+
3
+ - Use `references` in migration
4
+ - Fixed migration for SQLite
5
+
1
6
  ## 0.3.1
2
7
 
3
8
  - Fixed support for Rails 5.1
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
- rake db:migrate
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, -> (user) { user.admin? } do
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 = -> (search) { Rails.application.routes.url_helpers.items_path(q: search.query) }
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 = -> (search) { "#{search.query} #{search.city}" }
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 = -> (model) { model.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.integer :user_id
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.integer :convertable_id
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: "index_searchjoy_searches_on_search_type_normalized_query" # autogenerated name is too long
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
@@ -30,15 +30,8 @@ rescue LoadError
30
30
  end
31
31
 
32
32
  if defined?(Searchkick)
33
- module Searchkick
34
- class Query
35
- include Searchjoy::Track
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
@@ -1,7 +1,7 @@
1
1
  module Searchjoy
2
2
  module Track
3
- def execute_with_track
4
- results = execute_without_track
3
+ def execute
4
+ results = super
5
5
 
6
6
  if options[:track]
7
7
  attributes = options[:track] == true ? {} : options[:track]
@@ -1,3 +1,3 @@
1
1
  module Searchjoy
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
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.1
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: 2017-05-12 00:00:00.000000000 Z
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.11
148
+ rubygems_version: 2.6.13
148
149
  signing_key:
149
150
  specification_version: 4
150
151
  summary: Search analytics made easy