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 +1 -1
- data/lib/sunspot/query/base_query.rb +3 -3
- data/lib/sunspot/query.rb +4 -4
- data/lib/sunspot/session.rb +2 -2
- data/spec/api/build_search_spec.rb +10 -0
- data/spec/mocks/post.rb +3 -0
- data/tasks/gemspec.rake +0 -1
- data/tasks/rdoc.rake +1 -0
- metadata +2 -2
data/VERSION.yml
CHANGED
@@ -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
|
-
@
|
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
|
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(
|
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
|
|
data/lib/sunspot/session.rb
CHANGED
@@ -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
data/tasks/gemspec.rake
CHANGED
data/tasks/rdoc.rake
CHANGED
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
|
+
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-
|
15
|
+
date: 2009-08-13 00:00:00 -07:00
|
16
16
|
default_executable:
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|