lunar 0.2.1 → 0.2.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.
- data/VERSION +1 -1
- data/examples/ohm.rb +3 -2
- data/lib/lunar/sets.rb +2 -0
- data/lunar.gemspec +2 -2
- data/test/test_lunar_search.rb +18 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/examples/ohm.rb
CHANGED
@@ -32,8 +32,9 @@ Lunar.search(Item, "iphone")
|
|
32
32
|
# Or opt to filter by field
|
33
33
|
Lunar.search(Item, :name => "iphone", :description => "mobile")
|
34
34
|
|
35
|
+
# Or search a field using an array
|
36
|
+
Lunar.search(Item, :name => ["iphone", "apple"])
|
37
|
+
|
35
38
|
# Or using the pagination gem with this:
|
36
39
|
@items = Lunar.search(Item, "iphone")
|
37
40
|
paginate @items, :per_page => 10, :page => 1
|
38
|
-
|
39
|
-
"Lunar:Item:cost:2300"
|
data/lib/lunar/sets.rb
CHANGED
data/lunar.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{lunar}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Cyril David"]
|
12
|
-
s.date = %q{2010-05-
|
12
|
+
s.date = %q{2010-05-03}
|
13
13
|
s.description = %q{uses sorted sets and sets, sorting by score}
|
14
14
|
s.email = %q{cyx.ucron@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/test/test_lunar_search.rb
CHANGED
@@ -47,7 +47,7 @@ class LunarSearchTest < Test::Unit::TestCase
|
|
47
47
|
Lunar::Index.create "Item" do |i|
|
48
48
|
i.key 1003
|
49
49
|
i.attr :name, 'apple macbook pro 17"'
|
50
|
-
i.attr :desc, 'iphone'
|
50
|
+
i.attr :desc, 'iphone 4G'
|
51
51
|
i.integer :cost, '2300'
|
52
52
|
i.float :voting_quotient, '35.5'
|
53
53
|
end
|
@@ -98,6 +98,23 @@ class LunarSearchTest < Test::Unit::TestCase
|
|
98
98
|
assert items.map(&:id).include?('1001')
|
99
99
|
assert ! items.map(&:id).include?('1002')
|
100
100
|
end
|
101
|
+
|
102
|
+
should "be able to search by name: ['iphone', 'apple']" do
|
103
|
+
items = Lunar.search(Item, :name => ['iphone', 'apple'])
|
104
|
+
|
105
|
+
assert items.map(&:id).include?('1001')
|
106
|
+
assert items.map(&:id).include?('1002')
|
107
|
+
assert items.map(&:id).include?('1003')
|
108
|
+
end
|
109
|
+
|
110
|
+
should "be able to search by desc: ['iphone', 'apple']" do
|
111
|
+
items = Lunar.search(Item, :name => ['iphone', 'apple'])
|
112
|
+
|
113
|
+
assert items.map(&:id).include?('1001')
|
114
|
+
assert items.map(&:id).include?('1002')
|
115
|
+
assert items.map(&:id).include?('1003')
|
116
|
+
end
|
117
|
+
|
101
118
|
|
102
119
|
should "be able to search by name: 'iphone' desc: 'iphone'" do
|
103
120
|
items = Lunar.search(Item, :name => 'iphone', :desc => 'iphone')
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 2
|
9
|
+
version: 0.2.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Cyril David
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-05-
|
17
|
+
date: 2010-05-03 00:00:00 +08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|