searchkick 0.8.5 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -1
- data/CHANGELOG.md +9 -0
- data/Gemfile +1 -2
- data/README.md +33 -22
- data/ci/before_install.sh +14 -0
- data/gemfiles/activerecord41.gemfile +8 -0
- data/gemfiles/nobrainer.gemfile +6 -0
- data/lib/searchkick.rb +2 -2
- data/lib/searchkick/index.rb +405 -6
- data/lib/searchkick/model.rb +57 -47
- data/lib/searchkick/query.rb +18 -10
- data/lib/searchkick/results.rb +8 -1
- data/lib/searchkick/tasks.rb +1 -1
- data/lib/searchkick/version.rb +1 -1
- data/test/boost_test.rb +13 -3
- data/test/facets_test.rb +1 -0
- data/test/sql_test.rb +1 -1
- data/test/suggest_test.rb +7 -1
- data/test/test_helper.rb +42 -1
- metadata +6 -5
- data/lib/searchkick/reindex.rb +0 -339
- data/lib/searchkick/similar.rb +0 -19
data/lib/searchkick/similar.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
module Searchkick
|
2
|
-
module Similar
|
3
|
-
|
4
|
-
def similar(options = {})
|
5
|
-
like_text = self.class.searchkick_index.retrieve(self).to_hash
|
6
|
-
.keep_if{|k,v| !options[:fields] || options[:fields].map(&:to_s).include?(k) }
|
7
|
-
.values.compact.join(" ")
|
8
|
-
|
9
|
-
# TODO deep merge method
|
10
|
-
options[:where] ||= {}
|
11
|
-
options[:where][:_id] ||= {}
|
12
|
-
options[:where][:_id][:not] = id.to_s
|
13
|
-
options[:limit] ||= 10
|
14
|
-
options[:similar] = true
|
15
|
-
self.class.send(Searchkick.search_method_name, like_text, options)
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
end
|