outoftime-sunspot 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 4
2
+ :patch: 5
3
3
  :major: 0
4
4
  :minor: 9
@@ -9,8 +9,8 @@ module Sunspot
9
9
 
10
10
  attr_writer :keywords
11
11
 
12
- def initialize(setup)
13
- @setup = setup
12
+ def initialize(types, setup)
13
+ @types, @setup = types, setup
14
14
  end
15
15
 
16
16
  #
@@ -64,7 +64,7 @@ module Sunspot
64
64
  #
65
65
  def escaped_types
66
66
  @escaped_types ||=
67
- @setup.type_names.map { |name| escape(name)}
67
+ @types.map { |type| escape(type.name)}
68
68
  end
69
69
 
70
70
  #
data/lib/sunspot/query.rb CHANGED
@@ -20,12 +20,12 @@ module Sunspot
20
20
  class Query < FieldQuery
21
21
  attr_reader :query_facets #:nodoc:
22
22
 
23
- def initialize(setup, configuration) #:nodoc:
24
- @setup, @configuration = setup, configuration
23
+ def initialize(types, setup, configuration) #:nodoc:
24
+ @setup = setup
25
25
  @components = []
26
26
  @query_facets = {}
27
- @components << @base_query = BaseQuery.new(setup)
28
- @components << @pagination = Pagination.new(@configuration)
27
+ @components << @base_query = BaseQuery.new(types, setup)
28
+ @components << @pagination = Pagination.new(configuration)
29
29
  @components << @sort = SortComposite.new
30
30
  end
31
31
 
@@ -46,8 +46,8 @@ module Sunspot
46
46
  Setup.for(types.first)
47
47
  else
48
48
  CompositeSetup.for(types)
49
- end
50
- Search.new(connection, setup, Query::Query.new(setup, @config))
49
+ end
50
+ Search.new(connection, setup, Query::Query.new(types, setup, @config))
51
51
  end
52
52
 
53
53
  #
@@ -27,6 +27,16 @@ describe 'Search' do
27
27
  connection.should have_last_search_with(:fq => 'type:Post')
28
28
  end
29
29
 
30
+ it 'should search types in main query if keywords not used' do
31
+ session.search Post
32
+ connection.should have_last_search_with(:q => 'type:Post')
33
+ end
34
+
35
+ it 'should search type of subclass when superclass is configured' do
36
+ session.search PhotoPost
37
+ connection.should have_last_search_with(:q => 'type:PhotoPost')
38
+ end
39
+
30
40
  it 'should search all text fields for searched class' do
31
41
  session.search Post do
32
42
  keywords 'keyword search'
data/spec/mocks/post.rb CHANGED
@@ -68,3 +68,6 @@ Sunspot.setup(Post) do
68
68
  end
69
69
  end
70
70
  end
71
+
72
+ class PhotoPost < Post
73
+ end
data/tasks/gemspec.rake CHANGED
@@ -1,5 +1,4 @@
1
1
  begin
2
- gem 'technicalpickles-jeweler', '~> 1.0.1'
3
2
  require 'jeweler'
4
3
  Jeweler::Tasks.new do |s|
5
4
  s.name = 'sunspot'
data/tasks/rdoc.rake CHANGED
@@ -1,5 +1,6 @@
1
1
  gem 'mislav-hanna'
2
2
  require 'hanna/rdoctask'
3
+ require 'jeweler'
3
4
 
4
5
  Rake::RDocTask.new(:doc) do |rdoc|
5
6
  version = Jeweler::VersionHelper.new(File.join(File.dirname(__FILE__), '..')).to_s
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: outoftime-sunspot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mat Brown
@@ -12,7 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2009-07-29 00:00:00 -07:00
15
+ date: 2009-08-13 00:00:00 -07:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency