refinerycms-solr 1.0.8 → 1.0.9
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.
- checksums.yaml +4 -4
- data/lib/refinery/solr/version.rb +1 -1
- data/lib/refinery/sunspot/rich_document.rb +45 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c9d61ad5782d5aa2f57a71f5d579a05998e4e6a
|
4
|
+
data.tar.gz: b2b8f24c7903c5fc84fa8a5380921fee1b5e4cd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 803f4acbdd43e4d3ef1216ef72e07028b9cf7afafaee3ec826aa9e04c3d20fc97fce438be6ef2cd9a159f79ae025e67b9e870c6a70348ce19ab7b3eaf8437aa1
|
7
|
+
data.tar.gz: 0c71f7e1d12a4291ab100ba2c48209a3525b2571f420dca716953a400928cc96001e35891503a2e3d7f83a3194b6149cbc8aa25ed117c5edf297abf2f0b1c17f
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Sunspot
|
2
|
+
|
3
|
+
class RichDocument < RSolr::Xml::Document
|
4
|
+
include Enumerable
|
5
|
+
|
6
|
+
def contains_attachment?
|
7
|
+
@fields.each do |field|
|
8
|
+
if field.name.to_s.include?("_attachment") && field.value.present?
|
9
|
+
return true
|
10
|
+
end
|
11
|
+
end
|
12
|
+
return false
|
13
|
+
end
|
14
|
+
|
15
|
+
def add(connection)
|
16
|
+
params = {
|
17
|
+
:wt => :ruby
|
18
|
+
}
|
19
|
+
|
20
|
+
data = nil
|
21
|
+
|
22
|
+
@fields.each do |f|
|
23
|
+
if f.name.to_s.include?("_attachment") and f.value.present?
|
24
|
+
params['fmap.content'] = f.name
|
25
|
+
params['stream.file'] = f.value.path
|
26
|
+
params['stream.contentType'] = f.value.mime_type
|
27
|
+
else
|
28
|
+
param_name = "literal.#{f.name.to_s}"
|
29
|
+
params[param_name] = [] unless params.has_key?(param_name)
|
30
|
+
params[param_name] << f.value
|
31
|
+
end
|
32
|
+
if f.attrs[:boost]
|
33
|
+
params["boost.#{f.name.to_s}"] = f.attrs[:boost]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
connection.send_and_receive('update/extract',
|
38
|
+
{ :method => :post,
|
39
|
+
:params => params,
|
40
|
+
:data => data,
|
41
|
+
:headers => {"Content-Type" => ""}
|
42
|
+
})
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refinerycms-solr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Chaput
|
@@ -163,6 +163,7 @@ files:
|
|
163
163
|
- lib/refinery/solr/active_record.rb
|
164
164
|
- lib/refinery/solr/engine.rb
|
165
165
|
- lib/refinery/solr/version.rb
|
166
|
+
- lib/refinery/sunspot/rich_document.rb
|
166
167
|
- lib/refinerycms-solr.rb
|
167
168
|
- refinery-solr.gemspec
|
168
169
|
- script/rails
|