letsshop_mapper 0.8.6beta → 0.9.0beta
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.
- data/Rakefile +2 -0
- data/lib/letsshop_mapper/connection.rb +4 -2
- data/lib/letsshop_mapper/version.rb +2 -2
- data/test/letsshop_mapper_test.rb +14 -0
- metadata +5 -5
data/Rakefile
CHANGED
@@ -34,8 +34,10 @@ module LetsShopMapper
|
|
34
34
|
query << "&nhits=#{conditions[:nhits]}" if conditions[:nhits] != nil
|
35
35
|
if conditions[:f] != nil
|
36
36
|
refine = ""
|
37
|
-
conditions[:f].split(',')
|
38
|
-
|
37
|
+
refine_splited = conditions[:f].split(',')
|
38
|
+
refine_splited.each do |f|
|
39
|
+
refine << f.gsub(/(refine:||refine:\()+(\047)(.+)(\047)/, '\1"\3"').gsub(/(\047) (OR||AND) (\047)/, '" \2 "')
|
40
|
+
refine << "," unless f == refine_splited.last
|
39
41
|
end
|
40
42
|
query << "&f=#{CGI.escape(refine)}"
|
41
43
|
end
|
@@ -135,6 +135,20 @@ module LetsShopMapper
|
|
135
135
|
f = lshop.feed.entries[0].get_facets_by("brand")
|
136
136
|
assert_equal "levi's", f[0].title
|
137
137
|
end
|
138
|
+
def test_search_refine_with_operator_supplier
|
139
|
+
lshop = LetsShopMapper::Connection::Base::new("letsshop.dev.happun.com", "82842d494583280b940b208664f34014")
|
140
|
+
lshop.find({:f => "refine:('supplier:galeries lafayette' OR 'supplier:brandalley')", :start => 0, :nhits => 5})
|
141
|
+
assert_equal "UTF-8", lshop.feed.encoding
|
142
|
+
f = lshop.feed.get_facets_by("supplier")
|
143
|
+
assert_equal "brandalley", f[0].title
|
144
|
+
assert_equal "galeries lafayette", f[1].title
|
145
|
+
lshop.find({:f => "refine:('supplier:brandalley' AND 'brand:morgan')", :start => 0, :nhits => 5})
|
146
|
+
assert_equal "UTF-8", lshop.feed.encoding
|
147
|
+
f = lshop.feed.get_facets_by("supplier")
|
148
|
+
assert_equal "brandalley", f[0].title
|
149
|
+
f = lshop.feed.get_facets_by("brand")
|
150
|
+
assert_equal "morgan", f[0].title
|
151
|
+
end
|
138
152
|
def test_search_product
|
139
153
|
lshop = LetsShopMapper::Connection::Base::new("letsshop.dev.happun.com", "82842d494583280b940b208664f34014")
|
140
154
|
lshop.find({:producs => "b67ab565e1e0f2661e08845111a2106f"})
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: letsshop_mapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: -1139874821
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 9
|
9
|
+
- 0beta
|
10
|
+
version: 0.9.0beta
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- happun
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-08-10 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|