sunspot_suggest 0.0.1
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/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +32 -0
- data/Rakefile +1 -0
- data/lib/sunspot_suggest/plugin.rb +20 -0
- data/lib/sunspot_suggest/sunspot/dsl/standard_query.rb +15 -0
- data/lib/sunspot_suggest/sunspot/query/common_query.rb +16 -0
- data/lib/sunspot_suggest/sunspot/query/spellcheck.rb +22 -0
- data/lib/sunspot_suggest/sunspot/query/suggest.rb +28 -0
- data/lib/sunspot_suggest/sunspot/search/abstract_search.rb +130 -0
- data/lib/sunspot_suggest/version.rb +3 -0
- data/lib/sunspot_suggest.rb +6 -0
- data/spec/api/query/spellcheck_spec.rb +21 -0
- data/spec/api/search/spellcheck_search_spec.rb +116 -0
- data/spec/article.rb +12 -0
- data/spec/helpers/indexer_helper.rb +17 -0
- data/spec/helpers/integration_helper.rb +8 -0
- data/spec/helpers/mock_session_helper.rb +13 -0
- data/spec/helpers/query_helper.rb +26 -0
- data/spec/helpers/search_helper.rb +68 -0
- data/spec/helpers/spellcheck_helper.rb +66 -0
- data/spec/mocks/adapters.rb +36 -0
- data/spec/mocks/blog.rb +3 -0
- data/spec/mocks/comment.rb +21 -0
- data/spec/mocks/connection.rb +128 -0
- data/spec/mocks/mock_adapter.rb +30 -0
- data/spec/mocks/mock_class_sharding_session_proxy.rb +24 -0
- data/spec/mocks/mock_record.rb +52 -0
- data/spec/mocks/mock_sharding_session_proxy.rb +15 -0
- data/spec/mocks/photo.rb +11 -0
- data/spec/mocks/post.rb +86 -0
- data/spec/mocks/super_class.rb +2 -0
- data/spec/mocks/user.rb +13 -0
- data/spec/spec_helper.rb +50 -0
- data/sunspot_suggest.gemspec +26 -0
- metadata +184 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
class AbstractModel
|
|
2
|
+
end
|
|
3
|
+
|
|
4
|
+
class Model < AbstractModel
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
class UnseenModel < AbstractModel
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
class AbstractModelInstanceAdapter < Sunspot::Adapters::InstanceAdapter
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class AbstractModelDataAccessor < Sunspot::Adapters::DataAccessor
|
|
14
|
+
attr_accessor :to_be_injected
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
Sunspot::Adapters::InstanceAdapter.register(AbstractModelInstanceAdapter, AbstractModel)
|
|
18
|
+
Sunspot::Adapters::DataAccessor.register(AbstractModelDataAccessor, AbstractModel)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
module MixInModel
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
class MixModel
|
|
25
|
+
include MixInModel
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
class MixInModelInstanceAdapter < Sunspot::Adapters::InstanceAdapter
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
class MixInModelDataAccessor < Sunspot::Adapters::DataAccessor
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
Sunspot::Adapters::InstanceAdapter.register(MixInModelInstanceAdapter, MixInModel)
|
|
35
|
+
Sunspot::Adapters::DataAccessor.register(MixInModelDataAccessor, MixInModel)
|
|
36
|
+
|
data/spec/mocks/blog.rb
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module Namespaced
|
|
2
|
+
class Comment < MockRecord
|
|
3
|
+
attr_reader :id
|
|
4
|
+
attr_accessor :author_name, :published_at, :body, :average_rating, :boost,
|
|
5
|
+
:hash
|
|
6
|
+
|
|
7
|
+
def custom_float
|
|
8
|
+
@custom_float ||= {}
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
Sunspot.setup(Namespaced::Comment) do
|
|
14
|
+
text :body, :author_name
|
|
15
|
+
string :author_name
|
|
16
|
+
time :published_at, :trie => true
|
|
17
|
+
long :hash
|
|
18
|
+
double :average_rating
|
|
19
|
+
dynamic_float :custom_float, :multiple => true
|
|
20
|
+
boost :boost
|
|
21
|
+
end
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
module Mock
|
|
2
|
+
class ConnectionFactory
|
|
3
|
+
def connect(opts)
|
|
4
|
+
if @instance
|
|
5
|
+
raise('Factory can only create an instance once!')
|
|
6
|
+
else
|
|
7
|
+
@instance = Connection.new(opts)
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def new(url = nil)
|
|
12
|
+
if @instance
|
|
13
|
+
raise('Factory can only create an instance once!')
|
|
14
|
+
else
|
|
15
|
+
@instance = Connection.new(url)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def instance
|
|
20
|
+
@instance ||= Connection.new
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
class Connection
|
|
25
|
+
attr_reader :adds, :commits, :optims, :searches, :message, :opts, :deletes_by_query
|
|
26
|
+
attr_accessor :response
|
|
27
|
+
attr_writer :expected_handler
|
|
28
|
+
attr_reader :last_search
|
|
29
|
+
|
|
30
|
+
undef_method :select # annoyingly defined on Object
|
|
31
|
+
|
|
32
|
+
def initialize(opts = {})
|
|
33
|
+
@opts = opts
|
|
34
|
+
@message = OpenStruct.new
|
|
35
|
+
@adds, @deletes, @deletes_by_query, @commits, @optims, @searches = Array.new(6) { [] }
|
|
36
|
+
@expected_handler = :select
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def add(documents)
|
|
40
|
+
@adds << Array(documents)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def delete_by_id(ids)
|
|
44
|
+
@deletes << Array(ids)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def delete_by_query(query)
|
|
48
|
+
@deletes_by_query << query
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def commit
|
|
52
|
+
@commits << Time.now
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def optimize
|
|
56
|
+
@optims << Time.now
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def post(path, params)
|
|
60
|
+
unless path == "#{@expected_handler}"
|
|
61
|
+
raise ArgumentError, "Expected request to #{@expected_handler} request handler"
|
|
62
|
+
end
|
|
63
|
+
@searches << @last_search = params[:data]
|
|
64
|
+
@response || {}
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def method_missing(method, *args, &block)
|
|
68
|
+
get("#{method}", *args)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def has_add_with?(*documents)
|
|
72
|
+
@adds.any? do |add|
|
|
73
|
+
documents.all? do |document|
|
|
74
|
+
add.any? do |added|
|
|
75
|
+
if document.is_a?(Hash)
|
|
76
|
+
document.all? do |field, value|
|
|
77
|
+
added.fields_by_name(field).map do |field|
|
|
78
|
+
field.value.to_s
|
|
79
|
+
end == Array(value).map { |v| v.to_s }
|
|
80
|
+
end
|
|
81
|
+
else
|
|
82
|
+
!added.fields_by_name(document).empty?
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def has_delete?(*ids)
|
|
90
|
+
@deletes.any? do |delete|
|
|
91
|
+
delete & ids == ids
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def has_delete_by_query?(query)
|
|
96
|
+
@deletes_by_query.include?(query)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def has_last_search_with?(params)
|
|
100
|
+
with?(@last_search, params) if @last_search
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def has_last_search_including?(key, *values)
|
|
104
|
+
return unless @last_search
|
|
105
|
+
if @last_search.has_key?(key)
|
|
106
|
+
if @last_search[key].is_a?(Array)
|
|
107
|
+
(@last_search[key] & values).length == values.length
|
|
108
|
+
elsif values.length == 1
|
|
109
|
+
@last_search[key] == values.first
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
private
|
|
115
|
+
|
|
116
|
+
def with?(request, params)
|
|
117
|
+
if params.respond_to?(:all?)
|
|
118
|
+
params.all? do |key, value|
|
|
119
|
+
if request.has_key?(key)
|
|
120
|
+
request[key] == value
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
else
|
|
124
|
+
request.has_key?(params)
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'post')
|
|
2
|
+
|
|
3
|
+
module MockAdapter
|
|
4
|
+
class InstanceAdapter < Sunspot::Adapters::InstanceAdapter
|
|
5
|
+
def id
|
|
6
|
+
@instance.id
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
class DataAccessor < Sunspot::Adapters::DataAccessor
|
|
11
|
+
def load(id)
|
|
12
|
+
@clazz.get(id.to_i)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def load_all(ids)
|
|
16
|
+
all = @clazz.get_all(ids.map { |id| id.to_i })
|
|
17
|
+
if @custom_title
|
|
18
|
+
all.each { |item| item.title = @custom_title }
|
|
19
|
+
end
|
|
20
|
+
all
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def custom_title=(custom_title)
|
|
24
|
+
@custom_title = custom_title
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
Sunspot::Adapters::DataAccessor.register(MockAdapter::DataAccessor, MockRecord)
|
|
30
|
+
Sunspot::Adapters::InstanceAdapter.register(MockAdapter::InstanceAdapter, MockRecord)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
class MockClassShardingSessionProxy < Sunspot::SessionProxy::ClassShardingSessionProxy
|
|
2
|
+
attr_reader :post_session, :photo_session
|
|
3
|
+
|
|
4
|
+
def initialize(search_session)
|
|
5
|
+
super
|
|
6
|
+
@post_session, @photo_session = Sunspot::Session.new, Sunspot::Session.new
|
|
7
|
+
@post_session.config.solr.url = 'http://posts.solr.local/solr'
|
|
8
|
+
@photo_session.config.solr.url = 'http://photos.solr.local/solr'
|
|
9
|
+
@sessions = {
|
|
10
|
+
Post => @post_session,
|
|
11
|
+
Photo => @photo_session
|
|
12
|
+
}
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def session_for_class(clazz)
|
|
16
|
+
@sessions[clazz]
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def all_sessions
|
|
20
|
+
@sessions.values.sort do |lsession, rsession|
|
|
21
|
+
lsession.config.solr.url <=> rsession.config.solr.url
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
class MockRecord
|
|
2
|
+
IDS = Hash.new { |h, k| h[k] = 0 }
|
|
3
|
+
QUERY_COUNTS = Hash.new { |h, k| h[k] = 0 }
|
|
4
|
+
INSTANCES = Hash.new { |h, k| h[k] = {} }
|
|
5
|
+
|
|
6
|
+
attr_reader :id
|
|
7
|
+
|
|
8
|
+
class <<self
|
|
9
|
+
def reset!
|
|
10
|
+
IDS[name.to_sym] = 0
|
|
11
|
+
INSTANCES[name.to_sym] = {}
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def initialize(attrs = {})
|
|
16
|
+
@id = attrs.delete(:id) || IDS[self.class.name.to_sym] += 1
|
|
17
|
+
INSTANCES[self.class.name.to_sym][@id] = self
|
|
18
|
+
attrs.each_pair do |name, value|
|
|
19
|
+
send(:"#{name}=", value)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def self.inherited(base)
|
|
24
|
+
base.extend(ClassMethods)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
module ClassMethods
|
|
28
|
+
def get(id)
|
|
29
|
+
QUERY_COUNTS[self.name.to_sym] += 1
|
|
30
|
+
get_instance(id)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def get_all(ids)
|
|
34
|
+
QUERY_COUNTS[self.name.to_sym] += 1
|
|
35
|
+
ids.map { |id| get_instance(id) }.compact.sort_by { |instance| instance.id }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def query_count
|
|
39
|
+
QUERY_COUNTS[self.name.to_sym]
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
private
|
|
43
|
+
|
|
44
|
+
def get_instance(id)
|
|
45
|
+
INSTANCES[self.name.to_sym][id]
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def destroy
|
|
50
|
+
INSTANCES[self.class.name.to_sym].delete(@id)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class MockShardingSessionProxy < Sunspot::SessionProxy::ShardingSessionProxy
|
|
2
|
+
attr_reader :sessions
|
|
3
|
+
alias_method :all_sessions, :sessions
|
|
4
|
+
|
|
5
|
+
def initialize(search_session)
|
|
6
|
+
super
|
|
7
|
+
@sessions = Array.new(2) { Sunspot::Session.new }.each_with_index do |session, i|
|
|
8
|
+
session.config.solr.url = "http://localhost:898#{i}/solr"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def session_for(object)
|
|
13
|
+
@sessions[object.blog_id.to_i % 2]
|
|
14
|
+
end
|
|
15
|
+
end
|
data/spec/mocks/photo.rb
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
class Photo < MockRecord
|
|
2
|
+
attr_accessor :caption, :lat, :lng, :size, :average_rating, :created_at
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
Sunspot.setup(Photo) do
|
|
6
|
+
text :caption, :default_boost => 1.5
|
|
7
|
+
boost 0.75
|
|
8
|
+
integer :size, :trie => true
|
|
9
|
+
float :average_rating, :trie => true
|
|
10
|
+
time :created_at, :trie => true
|
|
11
|
+
end
|
data/spec/mocks/post.rb
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'blog')
|
|
2
|
+
require File.join(File.dirname(__FILE__), 'super_class')
|
|
3
|
+
|
|
4
|
+
class Post < SuperClass
|
|
5
|
+
attr_accessor :title, :body, :blog_id, :published_at, :ratings_average,
|
|
6
|
+
:author_name, :featured, :expire_date, :coordinates, :tags
|
|
7
|
+
alias_method :featured?, :featured
|
|
8
|
+
|
|
9
|
+
def category_ids
|
|
10
|
+
@category_ids ||= []
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def custom_string
|
|
14
|
+
@custom_string ||= {}
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def custom_fl
|
|
18
|
+
@custom_fl ||= {}
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def custom_time
|
|
22
|
+
@custom_time ||= {}
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def custom_boolean
|
|
26
|
+
@custom_boolean ||= {}
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
attr_writer :category_ids, :custom_string, :custom_fl, :custom_time, :custom_boolean
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
Sunspot.setup(Post) do
|
|
34
|
+
text :title, :boost => 2
|
|
35
|
+
text :body, :stored => true, :more_like_this => true
|
|
36
|
+
text :backwards_title do
|
|
37
|
+
title.reverse if title
|
|
38
|
+
end
|
|
39
|
+
text :tags, :more_like_this => true
|
|
40
|
+
string :title, :stored => true
|
|
41
|
+
integer :blog_id, :references => Blog
|
|
42
|
+
integer :category_ids, :multiple => true
|
|
43
|
+
float :average_rating, :using => :ratings_average, :trie => true
|
|
44
|
+
time :published_at, :trie => true
|
|
45
|
+
date :expire_date
|
|
46
|
+
boolean :featured, :using => :featured?, :stored => true
|
|
47
|
+
string :sort_title do
|
|
48
|
+
title.downcase.sub(/^(a|an|the)\W+/, '') if title
|
|
49
|
+
end
|
|
50
|
+
integer :primary_category_id do |post|
|
|
51
|
+
post.category_ids.first
|
|
52
|
+
end
|
|
53
|
+
time :last_indexed_at, :stored => true do
|
|
54
|
+
Time.now
|
|
55
|
+
end
|
|
56
|
+
location :coordinates
|
|
57
|
+
latlon(:coordinates_new) { coordinates }
|
|
58
|
+
|
|
59
|
+
dynamic_string :custom_string, :stored => true
|
|
60
|
+
dynamic_float :custom_float, :multiple => true, :using => :custom_fl
|
|
61
|
+
dynamic_integer :custom_integer do
|
|
62
|
+
category_ids.inject({}) do |hash, category_id|
|
|
63
|
+
hash.merge(category_id => 1)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
dynamic_time :custom_time
|
|
67
|
+
dynamic_boolean :custom_boolean
|
|
68
|
+
|
|
69
|
+
boost do
|
|
70
|
+
if ratings_average
|
|
71
|
+
1 + (ratings_average - 3.0) / 4.0
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
string :legacy, :as => :legacy_field_s do
|
|
76
|
+
"legacy #{title}"
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
string :legacy_array, :as => :legacy_array_field_sm, :multiple => true do
|
|
80
|
+
['first string', 'second string']
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
class PhotoPost < Post
|
|
85
|
+
end
|
|
86
|
+
|
data/spec/mocks/user.rb
ADDED
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
require 'pry'
|
|
4
|
+
require 'ostruct'
|
|
5
|
+
require 'forwardable'
|
|
6
|
+
require 'sunspot'
|
|
7
|
+
require 'sunspot_suggest'
|
|
8
|
+
|
|
9
|
+
require File.join(File.dirname(__FILE__), 'mocks', 'mock_record.rb')
|
|
10
|
+
Dir.glob(File.join(File.dirname(__FILE__), 'mocks', '**', '*.rb')).each do |file|
|
|
11
|
+
require file unless File.basename(file) == 'mock_record.rb'
|
|
12
|
+
end
|
|
13
|
+
Dir.glob(File.join(File.dirname(__FILE__), "helpers", "*.rb")).each do |file|
|
|
14
|
+
require file
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
require_relative 'article'
|
|
18
|
+
|
|
19
|
+
RSpec.configure do |config|
|
|
20
|
+
config.include SpellcheckHelper
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# config.filter_run :focus => true
|
|
24
|
+
|
|
25
|
+
# Mock session available to all spec/api tests
|
|
26
|
+
config.include MockSessionHelper,
|
|
27
|
+
:type => :api,
|
|
28
|
+
:example_group => {:file_path => /spec[\\\/]api/}
|
|
29
|
+
|
|
30
|
+
# Real Solr instance is available to integration tests
|
|
31
|
+
config.include IntegrationHelper,
|
|
32
|
+
:type => :integration,
|
|
33
|
+
:example_group => {:file_path => /spec[\\\/]integration/}
|
|
34
|
+
|
|
35
|
+
# Nested under spec/api
|
|
36
|
+
[:indexer, :query, :search].each do |spec_type|
|
|
37
|
+
helper_name = "#{spec_type}_helper"
|
|
38
|
+
|
|
39
|
+
config.include Sunspot::Util.full_const_get(Sunspot::Util.camel_case(helper_name)),
|
|
40
|
+
:type => spec_type,
|
|
41
|
+
:example_group => {:file_path => /spec[\\\/]api[\\\/]#{spec_type}/}
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def without_class(clazz)
|
|
47
|
+
Object.class_eval { remove_const(clazz.name.to_sym) }
|
|
48
|
+
yield
|
|
49
|
+
Object.class_eval { const_set(clazz.name.to_sym, clazz) }
|
|
50
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'sunspot_suggest/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "sunspot_suggest"
|
|
8
|
+
spec.version = SunspotSuggest::VERSION
|
|
9
|
+
spec.authors = ["rainkinz"]
|
|
10
|
+
spec.email = ["brendan.grainger@gmail.com"]
|
|
11
|
+
spec.description = %q{Adds suggest and spellcheck DSL methods}
|
|
12
|
+
spec.summary = %q{Adds suggest and spellcheck DSL methods}
|
|
13
|
+
spec.homepage = ""
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files`.split($/)
|
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
+
spec.require_paths = ["lib"]
|
|
20
|
+
|
|
21
|
+
spec.add_dependency "sunspot", "~> 2.0"
|
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
|
23
|
+
spec.add_development_dependency "rake"
|
|
24
|
+
spec.add_development_dependency 'rspec', '~>2.6.0'
|
|
25
|
+
spec.add_development_dependency 'pry'
|
|
26
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: sunspot_suggest
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
prerelease:
|
|
6
|
+
platform: ruby
|
|
7
|
+
authors:
|
|
8
|
+
- rainkinz
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2013-07-24 00:00:00.000000000 Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
15
|
+
name: sunspot
|
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
|
17
|
+
none: false
|
|
18
|
+
requirements:
|
|
19
|
+
- - ~>
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '2.0'
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
none: false
|
|
26
|
+
requirements:
|
|
27
|
+
- - ~>
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '2.0'
|
|
30
|
+
- !ruby/object:Gem::Dependency
|
|
31
|
+
name: bundler
|
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
|
33
|
+
none: false
|
|
34
|
+
requirements:
|
|
35
|
+
- - ~>
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '1.3'
|
|
38
|
+
type: :development
|
|
39
|
+
prerelease: false
|
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
+
none: false
|
|
42
|
+
requirements:
|
|
43
|
+
- - ~>
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: '1.3'
|
|
46
|
+
- !ruby/object:Gem::Dependency
|
|
47
|
+
name: rake
|
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
|
49
|
+
none: false
|
|
50
|
+
requirements:
|
|
51
|
+
- - ! '>='
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0'
|
|
54
|
+
type: :development
|
|
55
|
+
prerelease: false
|
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
none: false
|
|
58
|
+
requirements:
|
|
59
|
+
- - ! '>='
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
- !ruby/object:Gem::Dependency
|
|
63
|
+
name: rspec
|
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
|
65
|
+
none: false
|
|
66
|
+
requirements:
|
|
67
|
+
- - ~>
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
version: 2.6.0
|
|
70
|
+
type: :development
|
|
71
|
+
prerelease: false
|
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
73
|
+
none: false
|
|
74
|
+
requirements:
|
|
75
|
+
- - ~>
|
|
76
|
+
- !ruby/object:Gem::Version
|
|
77
|
+
version: 2.6.0
|
|
78
|
+
- !ruby/object:Gem::Dependency
|
|
79
|
+
name: pry
|
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
|
81
|
+
none: false
|
|
82
|
+
requirements:
|
|
83
|
+
- - ! '>='
|
|
84
|
+
- !ruby/object:Gem::Version
|
|
85
|
+
version: '0'
|
|
86
|
+
type: :development
|
|
87
|
+
prerelease: false
|
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
89
|
+
none: false
|
|
90
|
+
requirements:
|
|
91
|
+
- - ! '>='
|
|
92
|
+
- !ruby/object:Gem::Version
|
|
93
|
+
version: '0'
|
|
94
|
+
description: Adds suggest and spellcheck DSL methods
|
|
95
|
+
email:
|
|
96
|
+
- brendan.grainger@gmail.com
|
|
97
|
+
executables: []
|
|
98
|
+
extensions: []
|
|
99
|
+
extra_rdoc_files: []
|
|
100
|
+
files:
|
|
101
|
+
- .gitignore
|
|
102
|
+
- Gemfile
|
|
103
|
+
- LICENSE.txt
|
|
104
|
+
- README.md
|
|
105
|
+
- Rakefile
|
|
106
|
+
- lib/sunspot_suggest.rb
|
|
107
|
+
- lib/sunspot_suggest/plugin.rb
|
|
108
|
+
- lib/sunspot_suggest/sunspot/dsl/standard_query.rb
|
|
109
|
+
- lib/sunspot_suggest/sunspot/query/common_query.rb
|
|
110
|
+
- lib/sunspot_suggest/sunspot/query/spellcheck.rb
|
|
111
|
+
- lib/sunspot_suggest/sunspot/query/suggest.rb
|
|
112
|
+
- lib/sunspot_suggest/sunspot/search/abstract_search.rb
|
|
113
|
+
- lib/sunspot_suggest/version.rb
|
|
114
|
+
- spec/api/query/spellcheck_spec.rb
|
|
115
|
+
- spec/api/search/spellcheck_search_spec.rb
|
|
116
|
+
- spec/article.rb
|
|
117
|
+
- spec/helpers/indexer_helper.rb
|
|
118
|
+
- spec/helpers/integration_helper.rb
|
|
119
|
+
- spec/helpers/mock_session_helper.rb
|
|
120
|
+
- spec/helpers/query_helper.rb
|
|
121
|
+
- spec/helpers/search_helper.rb
|
|
122
|
+
- spec/helpers/spellcheck_helper.rb
|
|
123
|
+
- spec/mocks/adapters.rb
|
|
124
|
+
- spec/mocks/blog.rb
|
|
125
|
+
- spec/mocks/comment.rb
|
|
126
|
+
- spec/mocks/connection.rb
|
|
127
|
+
- spec/mocks/mock_adapter.rb
|
|
128
|
+
- spec/mocks/mock_class_sharding_session_proxy.rb
|
|
129
|
+
- spec/mocks/mock_record.rb
|
|
130
|
+
- spec/mocks/mock_sharding_session_proxy.rb
|
|
131
|
+
- spec/mocks/photo.rb
|
|
132
|
+
- spec/mocks/post.rb
|
|
133
|
+
- spec/mocks/super_class.rb
|
|
134
|
+
- spec/mocks/user.rb
|
|
135
|
+
- spec/spec_helper.rb
|
|
136
|
+
- sunspot_suggest.gemspec
|
|
137
|
+
homepage: ''
|
|
138
|
+
licenses:
|
|
139
|
+
- MIT
|
|
140
|
+
post_install_message:
|
|
141
|
+
rdoc_options: []
|
|
142
|
+
require_paths:
|
|
143
|
+
- lib
|
|
144
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
145
|
+
none: false
|
|
146
|
+
requirements:
|
|
147
|
+
- - ! '>='
|
|
148
|
+
- !ruby/object:Gem::Version
|
|
149
|
+
version: '0'
|
|
150
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
|
+
none: false
|
|
152
|
+
requirements:
|
|
153
|
+
- - ! '>='
|
|
154
|
+
- !ruby/object:Gem::Version
|
|
155
|
+
version: '0'
|
|
156
|
+
requirements: []
|
|
157
|
+
rubyforge_project:
|
|
158
|
+
rubygems_version: 1.8.23
|
|
159
|
+
signing_key:
|
|
160
|
+
specification_version: 3
|
|
161
|
+
summary: Adds suggest and spellcheck DSL methods
|
|
162
|
+
test_files:
|
|
163
|
+
- spec/api/query/spellcheck_spec.rb
|
|
164
|
+
- spec/api/search/spellcheck_search_spec.rb
|
|
165
|
+
- spec/article.rb
|
|
166
|
+
- spec/helpers/indexer_helper.rb
|
|
167
|
+
- spec/helpers/integration_helper.rb
|
|
168
|
+
- spec/helpers/mock_session_helper.rb
|
|
169
|
+
- spec/helpers/query_helper.rb
|
|
170
|
+
- spec/helpers/search_helper.rb
|
|
171
|
+
- spec/helpers/spellcheck_helper.rb
|
|
172
|
+
- spec/mocks/adapters.rb
|
|
173
|
+
- spec/mocks/blog.rb
|
|
174
|
+
- spec/mocks/comment.rb
|
|
175
|
+
- spec/mocks/connection.rb
|
|
176
|
+
- spec/mocks/mock_adapter.rb
|
|
177
|
+
- spec/mocks/mock_class_sharding_session_proxy.rb
|
|
178
|
+
- spec/mocks/mock_record.rb
|
|
179
|
+
- spec/mocks/mock_sharding_session_proxy.rb
|
|
180
|
+
- spec/mocks/photo.rb
|
|
181
|
+
- spec/mocks/post.rb
|
|
182
|
+
- spec/mocks/super_class.rb
|
|
183
|
+
- spec/mocks/user.rb
|
|
184
|
+
- spec/spec_helper.rb
|