noodall-core 0.6.1 → 0.6.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/lib/noodall/search.rb +1 -3
- data/lib/noodall/tagging.rb +1 -2
- data/noodall-core.gemspec +2 -2
- data/spec/node_spec.rb +9 -0
- data/spec/spec_helper.rb +3 -3
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.2
|
data/lib/noodall/search.rb
CHANGED
@@ -50,7 +50,7 @@ module Noodall
|
|
50
50
|
criteria.merge!( :_keywords => { :$in => words } )
|
51
51
|
|
52
52
|
# The Search result
|
53
|
-
search_result = collection.map_reduce(search_map(words), search_reduce, :query => criteria)
|
53
|
+
search_result = collection.map_reduce(search_map(words), search_reduce, :query => criteria, :out => "#{self.collection_name}_search")
|
54
54
|
|
55
55
|
# Add value to sort options because model is stored in the value key
|
56
56
|
options[:sort].map! do |s,v|
|
@@ -64,8 +64,6 @@ module Noodall
|
|
64
64
|
else
|
65
65
|
results = search_query.all
|
66
66
|
end
|
67
|
-
# clean up tmp collection
|
68
|
-
search_result.drop
|
69
67
|
#return results mappped to objects
|
70
68
|
results.tap do |docs|
|
71
69
|
docs.map! { |hash| load(hash['value']) }
|
data/lib/noodall/tagging.rb
CHANGED
@@ -12,10 +12,9 @@ module Noodall
|
|
12
12
|
query = query(options.reverse_merge(
|
13
13
|
:order => 'value DESC'
|
14
14
|
))
|
15
|
-
tags_map = collection.map_reduce(tag_cloud_map, tag_cloud_reduce, {:query => query.criteria.to_hash})
|
15
|
+
tags_map = collection.map_reduce(tag_cloud_map, tag_cloud_reduce, {:query => query.criteria.to_hash, :out => "#{self.collection_name}_tags" })
|
16
16
|
if tags_map.count > 0
|
17
17
|
tags = tags_map.find({}, query.options.to_hash ).to_a.collect{ |hash| Tag.new(hash['_id'], hash['value']) }
|
18
|
-
tags_map.drop # clean up tmp collection
|
19
18
|
tags
|
20
19
|
else
|
21
20
|
[]
|
data/noodall-core.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{noodall-core}
|
8
|
-
s.version = "0.6.
|
8
|
+
s.version = "0.6.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Steve England"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-05-11}
|
13
13
|
s.description = %q{Core data objects for Noodall}
|
14
14
|
s.email = %q{steve@wearebeef.co.uk}
|
15
15
|
s.extra_rdoc_files = [
|
data/spec/node_spec.rb
CHANGED
@@ -381,6 +381,15 @@ describe Noodall::Node do
|
|
381
381
|
ref.related.should have(2).things
|
382
382
|
end
|
383
383
|
|
384
|
+
it "should have a tag cloud" do
|
385
|
+
Factory(:page, :title => "My Page 1", :tag_list => 'one,two,three')
|
386
|
+
Factory(:page, :title => "My Page 2", :tag_list => 'two,three,four')
|
387
|
+
Factory(:page, :title => "My Page 3", :tag_list => 'three,four,five')
|
388
|
+
|
389
|
+
tags = Page.tag_cloud
|
390
|
+
tags.length.should == 5
|
391
|
+
end
|
392
|
+
|
384
393
|
it "should know who can be a parent" do
|
385
394
|
class LandingPage < Noodall::Node
|
386
395
|
sub_templates Page
|
data/spec/spec_helper.rb
CHANGED
@@ -11,7 +11,7 @@ MongoMapper.database = 'noodal-core-test'
|
|
11
11
|
|
12
12
|
DatabaseCleaner.strategy = :truncation
|
13
13
|
DatabaseCleaner.clean_with(:truncation)
|
14
|
-
|
14
|
+
|
15
15
|
|
16
16
|
Noodall::Node.slots :main, :wide, :small
|
17
17
|
|
@@ -20,7 +20,7 @@ require 'factories/component'
|
|
20
20
|
|
21
21
|
Rspec.configure do |config|
|
22
22
|
config.mock_with :rspec
|
23
|
-
|
23
|
+
|
24
24
|
config.before(:each) do
|
25
25
|
DatabaseCleaner.start
|
26
26
|
end
|
@@ -28,5 +28,5 @@ Rspec.configure do |config|
|
|
28
28
|
config.after(:each) do
|
29
29
|
DatabaseCleaner.clean
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: noodall-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 2
|
10
|
+
version: 0.6.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Steve England
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-05-11 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|