blacklight_iiif_search 2.1.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +7 -2
- data/app/controllers/concerns/blacklight_iiif_search/controller.rb +7 -11
- data/lib/blacklight_iiif_search/version.rb +1 -1
- data/lib/generators/blacklight_iiif_search/install_generator.rb +3 -2
- data/lib/generators/blacklight_iiif_search/routes_generator.rb +1 -1
- data/lib/generators/blacklight_iiif_search/solr_generator.rb +19 -4
- data/spec/iiif_search_shared.rb +2 -2
- data/spec/models/blacklight_iiif_search/iiif_search_response_spec.rb +1 -1
- data/spec/models/blacklight_iiif_search/iiif_suggest_response_spec.rb +1 -1
- data/spec/models/blacklight_iiif_search/iiif_suggest_search_spec.rb +1 -1
- metadata +25 -20
- data/lib/generators/blacklight_iiif_search/templates/solr/lib/solr-tokenizing_suggester-7.x.jar +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47f037fe96939a365bf695a81e1a11876b0fe4e6756e2c7cee7a7aaa23ef07df
|
4
|
+
data.tar.gz: be3140c6993352e0dfae2e5f8f014b6a70aea3fa9f9b39311d0bd171cf2bcda8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2fc141a9539fdd448c531ef69d8d93fc72919832dd256cdc5a988a7e3360f0241d4cde8ade9b7f4e800972e8288bc87109d3e2ad39f737cc563db11989e3b1e
|
7
|
+
data.tar.gz: 2c4c822c8304d444b1f0533153dbe49a9a07fb8b995f97e33bdeb72b501b06e4eadf72805ed540b6870847b074be8a6fc1658980f2e37200f6593e189aa0ec66
|
data/Rakefile
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rails'
|
3
5
|
begin
|
4
6
|
require 'bundler/setup'
|
5
7
|
rescue LoadError
|
@@ -36,8 +38,11 @@ RuboCop::RakeTask.new(:rubocop)
|
|
36
38
|
desc 'Run test suite'
|
37
39
|
task ci: [:rubocop, 'engine_cart:generate'] do
|
38
40
|
SolrWrapper.wrap do |solr|
|
39
|
-
|
40
|
-
|
41
|
+
# single-term autocomplete via tokenizing-suggest currently requires Solr 7.*, see README.md for more info
|
42
|
+
if solr.version.to_f < 8
|
43
|
+
FileUtils.cp(File.join(__dir__, 'lib', 'generators', 'blacklight_iiif_search', 'templates', 'solr', 'lib', 'tokenizing-suggest-v1.0.1.jar'),
|
44
|
+
File.join(solr.instance_dir, 'contrib'))
|
45
|
+
end
|
41
46
|
solr.with_collection do
|
42
47
|
within_test_app do
|
43
48
|
system 'RAILS_ENV=test rake blacklight_iiif_search:index:seed'
|
@@ -11,23 +11,19 @@ module BlacklightIiifSearch
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def iiif_search
|
14
|
-
|
15
|
-
iiif_search = IiifSearch.new(iiif_search_params, iiif_search_config,
|
16
|
-
@parent_document)
|
14
|
+
@parent_document = search_service.fetch(params[:solr_document_id])
|
15
|
+
iiif_search = IiifSearch.new(iiif_search_params, iiif_search_config, @parent_document)
|
17
16
|
iiif_search_service = search_service_class.new(config: blacklight_config,
|
18
17
|
user_params: iiif_search.solr_params)
|
19
|
-
@response
|
20
|
-
iiif_search_response = IiifSearchResponse.new(@response,
|
21
|
-
|
22
|
-
|
23
|
-
render json: iiif_search_response.annotation_list,
|
24
|
-
content_type: 'application/json'
|
18
|
+
@response = iiif_search_service.search_results
|
19
|
+
iiif_search_response = IiifSearchResponse.new(@response, @parent_document, self)
|
20
|
+
|
21
|
+
render json: iiif_search_response.annotation_list, content_type: 'application/json'
|
25
22
|
end
|
26
23
|
|
27
24
|
def iiif_suggest
|
28
25
|
suggest_search = IiifSuggestSearch.new(params, Blacklight.default_index, self)
|
29
|
-
render json: suggest_search.response,
|
30
|
-
content_type: 'application/json'
|
26
|
+
render json: suggest_search.response, content_type: 'application/json'
|
31
27
|
end
|
32
28
|
|
33
29
|
def iiif_search_config
|
@@ -18,13 +18,14 @@ module BlacklightIiifSearch
|
|
18
18
|
1. Injects behavior into CatalogController
|
19
19
|
2. Adds a SearchBuilder to ./app/models
|
20
20
|
3. Adds BlacklightIiifSearch routes to ./config/routes.rb
|
21
|
-
4. Modifies solrconfig.xml to support contextual autocomplete functionality
|
21
|
+
4. Modifies Solr schema.xml and solrconfig.xml to support contextual autocomplete functionality
|
22
22
|
Thanks for installing Blacklight IIIF Search!
|
23
23
|
EOS
|
24
24
|
|
25
25
|
def verify_blacklight_installed
|
26
26
|
return if IO.read('app/controllers/application_controller.rb').include?('include Blacklight::Controller')
|
27
27
|
say_status('info', 'BLACKLIGHT NOT INSTALLED; GENERATING BLACKLIGHT', :blue)
|
28
|
+
|
28
29
|
generate 'blacklight:install'
|
29
30
|
end
|
30
31
|
|
@@ -45,7 +46,7 @@ module BlacklightIiifSearch
|
|
45
46
|
end
|
46
47
|
|
47
48
|
def bundle_install
|
48
|
-
Bundler.
|
49
|
+
Bundler.with_unbundled_env do
|
49
50
|
run 'bundle install'
|
50
51
|
end
|
51
52
|
end
|
@@ -10,7 +10,7 @@ module BlacklightIiifSearch
|
|
10
10
|
desc 'This generator makes the following changes to your app:
|
11
11
|
1. Injects route declarations into your routes.rb'
|
12
12
|
|
13
|
-
# Add
|
13
|
+
# Add BlacklightIiifSearch to the routes
|
14
14
|
def inject_iiif_search_routes
|
15
15
|
return if IO.read('config/routes.rb').include?('BlacklightIiifSearch::Routes')
|
16
16
|
|
@@ -16,18 +16,22 @@ module BlacklightIiifSearch
|
|
16
16
|
marker = '</config>'
|
17
17
|
inject_into_file 'solr/conf/solrconfig.xml', before: marker do
|
18
18
|
" <!-- BEGIN Blacklight IIIF Search autocomplete config -->
|
19
|
-
<!--
|
20
|
-
|
19
|
+
<!-- tokenizing-suggest is necessary to return only single terms from the suggester -->
|
20
|
+
<!-- to use this, copy the blacklight_iiif_search/lib/generators/blacklight_iiif_search/templates/solr/lib/tokenizing-suggest-v1.0.1.jar -->
|
21
|
+
<!-- to your Solr install's contrib directory, and uncomment the lines below. -->
|
22
|
+
<!-- HOWEVER, this only works in Solr 7.*, see blacklight_iiif_search README for more info. -->
|
23
|
+
<!-- <lib dir=\"${solr.install.dir:../../../..}/contrib\" regex=\"tokenizing-suggest-v1.0.1.jar\" /> -->
|
21
24
|
<searchComponent name=\"iiif_suggest\" class=\"solr.SuggestComponent\">
|
22
25
|
<lst name=\"suggester\">
|
23
26
|
<str name=\"name\">iiifSuggester</str>
|
24
|
-
<str name=\"lookupImpl\">
|
27
|
+
<str name=\"lookupImpl\">AnalyzingInfixLookupFactory</str>
|
25
28
|
<str name=\"dictionaryImpl\">DocumentDictionaryFactory</str>
|
26
29
|
<str name=\"suggestAnalyzerFieldType\">textSuggest</str>
|
27
|
-
<str name=\"suggestTokenizingAnalyzerFieldType\">textSuggestTokenizer</str>
|
28
30
|
<str name=\"contextField\">is_page_of_ssi</str>
|
29
31
|
<str name=\"buildOnCommit\">true</str>
|
30
32
|
<str name=\"field\">iiif_suggest</str>
|
33
|
+
<!-- <str name=\"lookupImpl\">edu.stanford.dlss.search.suggest.analyzing.TokenizingLookupFactory</str> -->
|
34
|
+
<!-- <str name=\"suggestTokenizingAnalyzerFieldType\">textSuggestTokenizer</str> -->
|
31
35
|
</lst>
|
32
36
|
</searchComponent>\n
|
33
37
|
<requestHandler name=\"/iiif_suggest\" class=\"solr.SearchHandler\" startup=\"lazy\">
|
@@ -51,6 +55,8 @@ module BlacklightIiifSearch
|
|
51
55
|
field_type_marker = '</types>'
|
52
56
|
inject_into_file filepath, before: field_type_marker do
|
53
57
|
"\n <!-- BEGIN Blacklight IIIF Search autocomplete config -->
|
58
|
+
<!-- textSuggestTokenizer is only used by edu.stanford.dlss.search.suggest.analyzing.TokenizingLookupFactory -->
|
59
|
+
<!-- this fieldType can be ignored if using Solr > 7, see blacklight_iiif_search README for more info. -->
|
54
60
|
<fieldType name=\"textSuggestTokenizer\" class=\"solr.TextField\" positionIncrementGap=\"100\">
|
55
61
|
<analyzer>
|
56
62
|
<tokenizer class=\"solr.WhitespaceTokenizerFactory\"/>
|
@@ -79,6 +85,15 @@ module BlacklightIiifSearch
|
|
79
85
|
<copyField source=\"all_text_timv\" dest=\"iiif_suggest\"/>
|
80
86
|
<!-- END Blacklight IIIF Search autocomplete config -->\n\n"
|
81
87
|
end
|
88
|
+
|
89
|
+
textsuggest_marker = /<fieldType[\s]*name="textSuggest"[^>]*>[\s]*<analyzer>[\s]*<tokenizer class="solr.KeywordTokenizerFactory"\/>/
|
90
|
+
gsub_file(filepath, textsuggest_marker) do
|
91
|
+
"<fieldType name=\"textSuggest\" class=\"solr.TextField\" positionIncrementGap=\"100\">
|
92
|
+
<analyzer>
|
93
|
+
<!-- Blacklight IIIF Search autocomplete suggester config requires StandardTokenizerFactory -->
|
94
|
+
<!-- <tokenizer class=\"solr.KeywordTokenizerFactory\"/> -->
|
95
|
+
<tokenizer class=\"solr.StandardTokenizerFactory\"/>"
|
96
|
+
end
|
82
97
|
end
|
83
98
|
|
84
99
|
def copy_suggester_library
|
data/spec/iiif_search_shared.rb
CHANGED
@@ -16,8 +16,8 @@ RSpec.shared_context 'iiif_search_shared' do
|
|
16
16
|
let(:suggest_search_params) do
|
17
17
|
{ q: suggest_query_term, solr_document_id: parent_id, date: 'foo' }
|
18
18
|
end
|
19
|
-
let(:parent_document) { controller.search_service.fetch(parent_id)
|
20
|
-
let(:page_document) { controller.search_service.fetch(page_id)
|
19
|
+
let(:parent_document) { controller.search_service.fetch(parent_id) }
|
20
|
+
let(:page_document) { controller.search_service.fetch(page_id) }
|
21
21
|
let(:repository) { Blacklight::Solr::Repository.new(blacklight_config) }
|
22
22
|
|
23
23
|
let(:iiif_search) do
|
@@ -8,7 +8,7 @@ RSpec.describe BlacklightIiifSearch::IiifSearchResponse do
|
|
8
8
|
controller.search_service_class.new(config: blacklight_config,
|
9
9
|
user_params: iiif_search.solr_params)
|
10
10
|
end
|
11
|
-
let(:solr_response) { iiif_search_service.search_results
|
11
|
+
let(:solr_response) { iiif_search_service.search_results }
|
12
12
|
let(:iiif_search_response) do
|
13
13
|
described_class.new(solr_response, parent_document, controller)
|
14
14
|
end
|
@@ -30,7 +30,7 @@ RSpec.describe BlacklightIiifSearch::IiifSuggestResponse do
|
|
30
30
|
it 'returns the expected data' do
|
31
31
|
expect(response_terms.length).to eq(5)
|
32
32
|
expect(response_terms.first[:url]).not_to be_falsey
|
33
|
-
expect(response_terms.first[:match].match(
|
33
|
+
expect(response_terms.first[:match].match(/#{suggest_query_term}/)).to be_truthy
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -32,7 +32,7 @@ RSpec.describe BlacklightIiifSearch::IiifSuggestSearch do
|
|
32
32
|
it 'returns the expected data' do
|
33
33
|
terms = suggest_results['suggest'][blacklight_config.iiif_search[:suggester_name]][suggest_query_term]['suggestions']
|
34
34
|
expect(terms.length).to eq(5)
|
35
|
-
expect(terms.first['term'].match(
|
35
|
+
expect(terms.first['term'].match(/#{suggest_query_term}/)).to be_truthy
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight_iiif_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eben English
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,34 +16,34 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '6'
|
19
|
+
version: '6.1'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '8'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '6'
|
29
|
+
version: '6.1'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '8'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: blacklight
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
39
|
+
version: '8.0'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '8.0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: iiif-presentation
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -76,16 +76,22 @@ dependencies:
|
|
76
76
|
name: rspec-rails
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- - "
|
79
|
+
- - ">="
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
81
|
+
version: '6.1'
|
82
|
+
- - "<"
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '8'
|
82
85
|
type: :development
|
83
86
|
prerelease: false
|
84
87
|
version_requirements: !ruby/object:Gem::Requirement
|
85
88
|
requirements:
|
86
|
-
- - "
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '6.1'
|
92
|
+
- - "<"
|
87
93
|
- !ruby/object:Gem::Version
|
88
|
-
version: '
|
94
|
+
version: '8'
|
89
95
|
- !ruby/object:Gem::Dependency
|
90
96
|
name: solr_wrapper
|
91
97
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,14 +140,14 @@ dependencies:
|
|
134
140
|
requirements:
|
135
141
|
- - "~>"
|
136
142
|
- !ruby/object:Gem::Version
|
137
|
-
version:
|
143
|
+
version: '5.0'
|
138
144
|
type: :development
|
139
145
|
prerelease: false
|
140
146
|
version_requirements: !ruby/object:Gem::Requirement
|
141
147
|
requirements:
|
142
148
|
- - "~>"
|
143
149
|
- !ruby/object:Gem::Version
|
144
|
-
version:
|
150
|
+
version: '5.0'
|
145
151
|
description: Blacklight IIIF Search plugin
|
146
152
|
email:
|
147
153
|
- eenglish@bpl.org
|
@@ -169,7 +175,6 @@ files:
|
|
169
175
|
- lib/generators/blacklight_iiif_search/routes_generator.rb
|
170
176
|
- lib/generators/blacklight_iiif_search/solr_generator.rb
|
171
177
|
- lib/generators/blacklight_iiif_search/templates/iiif_search_builder.rb
|
172
|
-
- lib/generators/blacklight_iiif_search/templates/solr/lib/solr-tokenizing_suggester-7.x.jar
|
173
178
|
- lib/generators/blacklight_iiif_search/templates/solr/lib/tokenizing-suggest-v1.0.1.jar
|
174
179
|
- lib/railties/blacklight_iiif_search.rake
|
175
180
|
- spec/controllers/catalog_controller_spec.rb
|
@@ -191,7 +196,7 @@ licenses:
|
|
191
196
|
metadata:
|
192
197
|
homepage_uri: https://github.com/boston-library/blacklight_iiif_search
|
193
198
|
source_code_uri: https://github.com/boston-library/blacklight_iiif_search
|
194
|
-
post_install_message:
|
199
|
+
post_install_message:
|
195
200
|
rdoc_options: []
|
196
201
|
require_paths:
|
197
202
|
- lib
|
@@ -199,15 +204,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
199
204
|
requirements:
|
200
205
|
- - ">="
|
201
206
|
- !ruby/object:Gem::Version
|
202
|
-
version: '
|
207
|
+
version: '2.7'
|
203
208
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
209
|
requirements:
|
205
210
|
- - ">="
|
206
211
|
- !ruby/object:Gem::Version
|
207
212
|
version: '0'
|
208
213
|
requirements: []
|
209
|
-
rubygems_version: 3.
|
210
|
-
signing_key:
|
214
|
+
rubygems_version: 3.3.27
|
215
|
+
signing_key:
|
211
216
|
specification_version: 4
|
212
217
|
summary: Blacklight IIIF Search plugin
|
213
218
|
test_files:
|