scooby_snacks 0.3.2 → 0.3.3
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 +5 -5
- data/.gitignore +1 -0
- data/lib/scooby_snacks/blacklight_configuration.rb +7 -8
- data/lib/scooby_snacks/field.rb +30 -19
- data/lib/scooby_snacks/solr_behavior.rb +2 -2
- data/lib/scooby_snacks/version.rb +1 -1
- data/lib/scooby_snacks/work_form_behavior.rb +1 -2
- data/lib/scooby_snacks/work_model_behavior.rb +2 -1
- metadata +3 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 228854434b05709dc74c5c33b7aeba6fb15983d3d91917e1a24ef32d2509e523
|
|
4
|
+
data.tar.gz: 55471a7d4165a20509d63f416ff25c7dcdd79779fc0b89dd9cc2c5b0fb3d1766
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 13a899775252d026e4d927e3028533ea6a406d8184cb6068e5003ed95878d24a399d65bdce913d7d4cd6851617171b33b9e57bf45009a55029445d7bb571ba71
|
|
7
|
+
data.tar.gz: ed34501d6617d98fbd940bb0f04393db896d10f3fd997d321f46ddc46445fdbf820aa19612b2b36160017ce2ac694413d465106ec0a04daa29f418e2b41195e5
|
data/.gitignore
CHANGED
|
@@ -12,19 +12,18 @@ module ScoobySnacks
|
|
|
12
12
|
def self.add_show_fields(config)
|
|
13
13
|
self.schema.display_fields.each do |field|
|
|
14
14
|
begin
|
|
15
|
-
config.add_show_field field.
|
|
15
|
+
config.add_show_field field.solr_name, label: field.label
|
|
16
16
|
rescue
|
|
17
|
-
Rails.logger.error "error adding field: #{field.
|
|
17
|
+
Rails.logger.error "error adding field: #{field.solr_name} for property #{field.label}. Redundant definition?"
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def self.add_search_fields(config)
|
|
23
23
|
self.schema.searchable_fields.each do |field|
|
|
24
|
-
config.add_search_field(field.name) do |new_field|
|
|
25
|
-
new_field.
|
|
26
|
-
|
|
27
|
-
qf: field.solr_search_name,
|
|
24
|
+
config.add_search_field(field.name, label: field.label, include_in_advanced_search: true) do |new_field|
|
|
25
|
+
new_field.solr_parameters = {
|
|
26
|
+
qf: field.solr_search_name.to_s,
|
|
28
27
|
pf: field.solr_search_name
|
|
29
28
|
}
|
|
30
29
|
end
|
|
@@ -45,7 +44,7 @@ module ScoobySnacks
|
|
|
45
44
|
|
|
46
45
|
def self.add_search_result_display_fields(config)
|
|
47
46
|
self.schema.search_result_display_fields.each do |field|
|
|
48
|
-
config.add_index_field(field.
|
|
47
|
+
config.add_index_field(field.solr_name, self.get_index_options(field))
|
|
49
48
|
end
|
|
50
49
|
end
|
|
51
50
|
|
|
@@ -54,7 +53,7 @@ module ScoobySnacks
|
|
|
54
53
|
options[:label] = field.label || field.name
|
|
55
54
|
options[:index_itemprop] = field.itemprop if field.itemprop
|
|
56
55
|
options[:helper_method] = field.helper_method if field.helper_method
|
|
57
|
-
options[:link_to_search] = field.solr_search_name if field.
|
|
56
|
+
options[:link_to_search] = field.solr_search_name if field.searchable?
|
|
58
57
|
return options
|
|
59
58
|
end
|
|
60
59
|
|
data/lib/scooby_snacks/field.rb
CHANGED
|
@@ -105,9 +105,9 @@ module ScoobySnacks
|
|
|
105
105
|
|
|
106
106
|
def display_options
|
|
107
107
|
options = {label: label}
|
|
108
|
-
if
|
|
108
|
+
if searchable?
|
|
109
109
|
options[:render_as] = :linked
|
|
110
|
-
options[:search_field] =
|
|
110
|
+
options[:search_field] = name
|
|
111
111
|
end
|
|
112
112
|
return options
|
|
113
113
|
end
|
|
@@ -136,29 +136,40 @@ module ScoobySnacks
|
|
|
136
136
|
vocabularies.first
|
|
137
137
|
end
|
|
138
138
|
|
|
139
|
-
def
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
type = "d"
|
|
147
|
-
else
|
|
148
|
-
type = "te"
|
|
149
|
-
end
|
|
150
|
-
type = "s" if facet
|
|
151
|
-
index = (search? or facet) ? "i" : ""
|
|
152
|
-
multiple = multiple? ? "m" : ""
|
|
153
|
-
return "#{name}_#{type}s#{index}#{multiple}"
|
|
139
|
+
def solr_names
|
|
140
|
+
solr_descriptors.reduce([]){|names, desc| names << solr_name(desc)}
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def solr_name(descriptor = nil)
|
|
144
|
+
descriptor ||= solr_descriptors.first
|
|
145
|
+
Solrizer.solr_name(name,descriptor,type: solr_data_type)
|
|
154
146
|
end
|
|
155
147
|
|
|
156
148
|
def solr_search_name
|
|
157
|
-
|
|
149
|
+
return "" unless searchable?
|
|
150
|
+
solr_name(:stored_searchable)
|
|
158
151
|
end
|
|
159
152
|
|
|
160
153
|
def solr_facet_name
|
|
161
|
-
|
|
154
|
+
return "" unless facet?
|
|
155
|
+
solr_name(:facetable)
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def solr_sort_name
|
|
159
|
+
return "" unless sort?
|
|
160
|
+
solr_name(:stored_sortable)
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def solr_descriptors
|
|
164
|
+
descriptors = []
|
|
165
|
+
descriptors << :stored_searchable if searchable?
|
|
166
|
+
descriptors << :facetable if facet?
|
|
167
|
+
descriptors << :displayable if (descriptors.empty? && stored_in_solr?)
|
|
168
|
+
return descriptors
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
def solr_data_type
|
|
172
|
+
@raw_array['data_type'].downcase.to_sym || :text
|
|
162
173
|
end
|
|
163
174
|
|
|
164
175
|
private
|
|
@@ -63,8 +63,8 @@ module ScoobySnacks::SolrBehavior
|
|
|
63
63
|
ScoobySnacks::METADATA_SCHEMA.stored_in_solr_fields.each do |field|
|
|
64
64
|
next if respond_to? field.name
|
|
65
65
|
# define a attribute for the current property
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
add_field_semantics(field.oai_element, field.solr_name) if (field.oai? && field.oai_ns == 'dc')
|
|
67
|
+
attribute(field.name.to_sym, (field.date? ? Solr::Date : Solr::Array), field.solr_name) unless field.hidden?
|
|
68
68
|
end
|
|
69
69
|
end
|
|
70
70
|
end
|
|
@@ -28,9 +28,8 @@ module ScoobySnacks::WorkFormBehavior
|
|
|
28
28
|
ScoobySnacks::METADATA_SCHEMA.controlled_field_names.each do |field_name|
|
|
29
29
|
permitted << {"#{field_name}_attributes".to_sym => [:id, :_destroy]}
|
|
30
30
|
end
|
|
31
|
-
return
|
|
31
|
+
return permitted
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
|
|
35
34
|
end
|
|
36
35
|
end
|
|
@@ -13,7 +13,8 @@ module ScoobySnacks::WorkModelBehavior
|
|
|
13
13
|
# unless it is already defined (e.g. in hyrax core)
|
|
14
14
|
unless respond_to? field.name.to_sym
|
|
15
15
|
property field.name.to_sym, {predicate: field.predicate, multiple: field.multiple?} do |index|
|
|
16
|
-
index.as
|
|
16
|
+
index.as *field.solr_descriptors
|
|
17
|
+
index.type field.solr_data_type
|
|
17
18
|
end
|
|
18
19
|
end
|
|
19
20
|
end #end fields loop
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: scooby_snacks
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- UCSC Library Digital Initiatives Department, Ned Henry
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-05-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -99,8 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
99
99
|
- !ruby/object:Gem::Version
|
|
100
100
|
version: '0'
|
|
101
101
|
requirements: []
|
|
102
|
-
|
|
103
|
-
rubygems_version: 2.6.14
|
|
102
|
+
rubygems_version: 3.0.3
|
|
104
103
|
signing_key:
|
|
105
104
|
specification_version: 4
|
|
106
105
|
summary: A helper gem to define metadata schema in configuration files in Hyrax (Samvera)
|