algoliasearch-rails 1.4.1 → 1.4.2
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/.travis.yml +1 -1
- data/ChangeLog +4 -0
- data/VERSION +1 -1
- data/algoliasearch-rails.gemspec +1 -1
- data/lib/algoliasearch-rails.rb +13 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1a8a98b4773a8017d1999a6677431a0e62986bb
|
4
|
+
data.tar.gz: 9d44b24a5e961e77f2d9d3e410062a7fefb586bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f675a30e07369d2dcbfe090a18b2b485f395b29078b86964a04e8d474a299b7802e84290afb98089e966f508d94f75fe1ede858a20b07585587b6ea18266188
|
7
|
+
data.tar.gz: 92e0aa9140655da8f9e082ea6c870f9a6b6d5f1705a40c844e8424f4b9b25718e95dca963d1f47c240fb154fb3a8f43f1275bdb971e468a8068ebb20faf0ed33
|
data/.travis.yml
CHANGED
data/ChangeLog
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.4.
|
1
|
+
1.4.2
|
data/algoliasearch-rails.gemspec
CHANGED
data/lib/algoliasearch-rails.rb
CHANGED
@@ -160,7 +160,7 @@ module AlgoliaSearch
|
|
160
160
|
ensure_init
|
161
161
|
json = @index.search(q, Hash[settings.map { |k,v| [k.to_s, v.to_s] }])
|
162
162
|
results = json['hits'].map do |hit|
|
163
|
-
o =
|
163
|
+
o = full_const_get(@options[:type].to_s).find(hit['objectID'])
|
164
164
|
o.highlight_result = hit['_highlightResult']
|
165
165
|
o
|
166
166
|
end
|
@@ -205,6 +205,18 @@ module AlgoliaSearch
|
|
205
205
|
false
|
206
206
|
end
|
207
207
|
|
208
|
+
def full_const_get(name)
|
209
|
+
list = name.split('::')
|
210
|
+
list.shift if list.first.blank?
|
211
|
+
obj = self
|
212
|
+
list.each do |x|
|
213
|
+
# This is required because const_get tries to look for constants in the
|
214
|
+
# ancestor chain, but we only want constants that are HERE
|
215
|
+
obj = obj.const_defined?(x) ? obj.const_get(x) : obj.const_missing(x)
|
216
|
+
end
|
217
|
+
obj
|
218
|
+
end
|
219
|
+
|
208
220
|
end
|
209
221
|
|
210
222
|
# these are the instance methods included
|