solr_ead 0.4.5 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +2 -0
- data/.travis.yml +7 -0
- data/README.md +61 -43
- data/Rakefile +2 -1
- data/config/jetty.yml +9 -0
- data/config/solr.yml +3 -3
- data/lib/solr_ead/behaviors.rb +8 -8
- data/lib/solr_ead/component.rb +16 -4
- data/lib/solr_ead/document.rb +10 -7
- data/lib/solr_ead/indexer.rb +35 -31
- data/lib/solr_ead/version.rb +1 -1
- data/lib/solr_ead.rb +16 -14
- data/lib/tasks/solr_ead_dev.rake +22 -0
- data/solr/schema.xml +1163 -0
- data/solr_ead.gemspec +9 -7
- data/spec/component_spec.rb +18 -18
- data/spec/document_spec.rb +12 -14
- data/spec/indexer_spec.rb +8 -8
- metadata +31 -42
- data/Gemfile.lock +0 -80
- data/lib/ead_mapper.rb +0 -13
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YzBlY2QzY2Y2MzdlNDhjNDg3NjRjOWJkOWNkNWUyNzZkM2M2OWYwMw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MWYzMjQ0YTc1NDRiZmNmZTg2MTBlZWE1YmE0YzA1OTJhMzM5Yzg2OA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
Yzk1ZWI5NTE4ZWE4ZDUzNGU5ZGQ4MWFjOTQxNDViZjc3OWY1MThmNjM5NmQ0
|
10
|
+
NTY4YjQ0YzYxYmNlOTlmMjhkNDE3YjczY2ZlMmNhN2E1NGFiYzQxMGEzMjA1
|
11
|
+
MWU0OTc1ZDJlNmI0ODk0MTVmYzNhMjJiNjg2MGFkMTI4NjJiN2E=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
Njg0MTY0Y2Q0YTQxMzViZmUwNTY3MzkwNjEwMTNlMjJlODZlYjE1ZWVlZWMy
|
14
|
+
ODZlNzMzZDM4YjhiZjg3NWIwNWY0Zjk2OTc4NGZmNzQ4OGM0MjUwNjI3ODZm
|
15
|
+
YWQxZDc3ZjQ4ZGVjM2ZhZWRkMmVjNjEwNjczM2Q5ODIxYmEzOTY=
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# SolrEad
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/awead/solr_ead.png?branch=master)](https://travis-ci.org/awead/solr_ead)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/solr_ead.png)](http://badge.fury.io/rb/solr_ead)
|
5
|
+
|
3
6
|
SolrEad is a gem that indexes your ead documents into Solr. From there, you can use other
|
4
7
|
Solr-based applications to search and display your finding aids. It originated as some
|
5
8
|
code that I used to index ead into Blacklight, but this gem does not require you to use
|
@@ -47,32 +50,10 @@ You can also do this via the command line:
|
|
47
50
|
> indexer = SolrEad::Indexer.new
|
48
51
|
> indexer.create(File.new("path/to/your/ead.xml))
|
49
52
|
|
50
|
-
### Usage with Blacklight
|
51
|
-
|
52
|
-
This code originated in a Blacklight application and some of its default solr fields
|
53
|
-
reflect a Blacklight-style solr implementation. For example, certain facet fields such as
|
54
|
-
subject_topic_facet and title_display will appear in your solr index by default. If you
|
55
|
-
are trying out the gem within a default Blacklight installation, you will need to make
|
56
|
-
the following changes to your schema.xml file:
|
57
|
-
|
58
|
-
<dynamicField name="*_id" type="string" indexed="true" stored="true" multiValued="false" />
|
59
|
-
<dynamicField name="*_s" type="string" indexed="true" stored="true" multiValued="true" />
|
60
|
-
|
61
|
-
Fields ending in "_id" are used for identifying components within finding aids as well as
|
62
|
-
the finding aid itself, which may not always be the same as the default "id" field for
|
63
|
-
the solr document. "_s" fields are not multivalued by default in Blacklight, so you'll
|
64
|
-
need to edit the existing entry for this dyamic field to reflect the change.
|
65
|
-
|
66
|
-
Other than that, your solr configuration should require no futher modifications;
|
67
|
-
however, the only fields that will appear in your search results will be format
|
68
|
-
and title. In order to make this into working solution, you'll need to modify
|
69
|
-
both the definitions of documents and components within SolrEad and configure
|
70
|
-
Blacklight's own display and facet fields accordingly.
|
71
|
-
|
72
53
|
## Applications
|
73
54
|
|
74
55
|
SolrEad is intended to work at the indexing layer of an application, but it can also work
|
75
|
-
at the display
|
56
|
+
at the display and presentation layer as well. You can use the solr fields defined in your OM
|
76
57
|
terminology for display; however, formatting information such as italics and boldface is
|
77
58
|
not preserved from the original EAD xml.
|
78
59
|
|
@@ -85,9 +66,9 @@ pages created using XSLT, or create the html when the page is requested. If you
|
|
85
66
|
the latter, you can store the ead xml in a solr field. To do this, add a new solr field
|
86
67
|
under the to_solr method of your OM terminology for the ead document:
|
87
68
|
|
88
|
-
|
69
|
+
Solrizer.insert_field(solr_doc, "xml", self.to_xml, :displayable)
|
89
70
|
|
90
|
-
This will create the solr field "
|
71
|
+
This will create the solr field "xml_ssm" containing the complete ead xml. Then you
|
91
72
|
will be able to apply any xslt processing you wish. Other solutions are possible using
|
92
73
|
xml from the document as well as the component, depending on the needs of your
|
93
74
|
application.
|
@@ -104,6 +85,15 @@ following content:
|
|
104
85
|
|
105
86
|
class CustomDocument < SolrEad::Document
|
106
87
|
|
88
|
+
# Use the existing terminology
|
89
|
+
use_terminology SolrEad::Document
|
90
|
+
|
91
|
+
# And extend it with terms of your own
|
92
|
+
extend_terminology do |t|
|
93
|
+
...
|
94
|
+
end
|
95
|
+
|
96
|
+
# Or, just define your own from scratch
|
107
97
|
set_terminology do |t|
|
108
98
|
t.root(:path="ead", :index_as = [:not_searchable])
|
109
99
|
t.eadid
|
@@ -167,31 +157,50 @@ Then, include your module in your own custom document and call the method during
|
|
167
157
|
|
168
158
|
include MyEadBehaviors
|
169
159
|
|
170
|
-
|
160
|
+
use_terminology SolrEad::Document
|
171
161
|
|
172
162
|
def to_solr(solr_doc = Hash.new)
|
173
163
|
super(solr_doc)
|
174
|
-
|
164
|
+
Solrizer.insert_field(solr_doc, "field", special_process(self.field), :displayable)
|
175
165
|
end
|
176
166
|
|
177
167
|
end
|
178
168
|
|
179
|
-
Your solr document will now include the field "
|
180
|
-
"
|
169
|
+
Your solr document will now include the field "field_ssm" that has taken the term
|
170
|
+
"field" and processed it with the special_process method.
|
181
171
|
|
182
172
|
### Solr schema configurations
|
183
173
|
|
184
|
-
SolrEad
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
174
|
+
SolrEad uses Solrizer's default field descriptors to create the names of solr fields. A complete
|
175
|
+
listing of these fields is found under
|
176
|
+
[Solrizer::DefaultDescriptors](https://github.com/projecthydra/solrizer/blob/master/lib/solrizer/default_descriptors.rb)
|
177
|
+
but the options that are used here are specifically:
|
178
|
+
|
179
|
+
:displayable
|
180
|
+
:stored_sortable
|
181
|
+
:type => :integer
|
182
|
+
:type => :boolean
|
183
|
+
:facetable
|
184
|
+
:sortable, :type => :integer
|
185
|
+
:searchable
|
186
|
+
|
187
|
+
These result in a specific set of dynamic field names that will need to be present in your schema.xml file in
|
188
|
+
solr. In order to have these fields index correctly, include the following in your schema.xml file:
|
189
|
+
|
190
|
+
<dynamicField name="*_teim" type="text_en" stored="false" indexed="true" multiValued="true" />
|
191
|
+
<dynamicField name="*_si" type="string" stored="false" indexed="true" multiValued="false" />
|
192
|
+
<dynamicField name="*_sim" type="string" stored="false" indexed="true" multiValued="true" />
|
193
|
+
<dynamicField name="*_ssm" type="string" stored="true" indexed="false" multiValued="true" />
|
194
|
+
<dynamicField name="*_ssi" type="string" stored="true" indexed="true" multiValued="false" />
|
195
|
+
<dynamicField name="*_ssim" type="string" stored="true" indexed="true" multiValued="true" />
|
196
|
+
<dynamicField name="*_dtsi" type="date" stored="true" indexed="true" multiValued="false" />
|
197
|
+
<dynamicField name="*_dtsim" type="date" stored="true" indexed="true" multiValued="true" />
|
198
|
+
<dynamicField name="*_bsi" type="boolean" stored="true" indexed="true" multiValued="false" />
|
199
|
+
<dynamicField name="*_isim" type="int" stored="true" indexed="true" multiValued="true" />
|
200
|
+
<dynamicField name="*_ii" type="int" stored="false" indexed="true" multiValued="false" />
|
201
|
+
|
202
|
+
Note that the type "text_en" is dependent on your particular solr application, but the others should be
|
203
|
+
included in the default installation.
|
195
204
|
|
196
205
|
## Issues
|
197
206
|
|
@@ -199,13 +208,22 @@ your solrconfig.xml file, under the "search" request handler:
|
|
199
208
|
|
200
209
|
solr_ead uses the <eadid> node to create unique ids for documents. Consequently, if you're using
|
201
210
|
a rails app, this id will be a part of the url. If your eadid has .xml or some other combination
|
202
|
-
of characters
|
211
|
+
of characters preceded by a period, this will cause Rails to interpret these characters as a
|
203
212
|
format, which you don't want. You may need to edit your eadid nodes if this is the case.
|
204
213
|
|
205
214
|
## Contributing
|
206
215
|
|
207
|
-
|
208
|
-
|
216
|
+
### Testing with Jettywrapper
|
217
|
+
|
218
|
+
SolrEad uses jettywrapper to download a solr application for testing. To get setup for developing
|
219
|
+
additional features for SolrEad:
|
220
|
+
|
221
|
+
git clone https://github.com/awead/solr_ead
|
222
|
+
bundle install
|
223
|
+
rake ci
|
224
|
+
|
225
|
+
This will download jetty, start it up and run the spec tests. If you have questions or have specific needs, let me know.
|
226
|
+
If you have other ideas or solutions, please contribute code!
|
209
227
|
|
210
228
|
1. Fork SolrEad
|
211
229
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
data/Rakefile
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
2
|
require "bundler/gem_tasks"
|
3
3
|
require "rspec/core/rake_task"
|
4
|
+
require "jettywrapper"
|
4
5
|
Bundler::GemHelper.install_tasks
|
5
6
|
# load rake tasks in lib/tasks
|
6
7
|
Dir.glob('lib/tasks/*.rake').each { |r| import r }
|
7
8
|
RSpec::Core::RakeTask.new(:spec)
|
8
|
-
task :default => :
|
9
|
+
task :default => :ci
|
data/config/jetty.yml
ADDED
data/config/solr.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
development:
|
2
|
-
url: http://127.0.0.1:
|
2
|
+
url: http://127.0.0.1:8983/solr/hydra-dev
|
3
3
|
test: &test
|
4
|
-
url: http://127.0.0.1:
|
4
|
+
url: http://127.0.0.1:8983/solr/hydra-dev
|
5
5
|
production:
|
6
|
-
url: http://127.0.0.1:
|
6
|
+
url: http://127.0.0.1:8983/solr/hydra-dev
|
data/lib/solr_ead/behaviors.rb
CHANGED
@@ -58,14 +58,14 @@ module SolrEad::Behaviors
|
|
58
58
|
# These fields are used so that we may reconstruct placement of a single component
|
59
59
|
# within the hierarchy of the original ead.
|
60
60
|
def additional_component_fields(node, addl_fields = Hash.new)
|
61
|
-
addl_fields["id"]
|
62
|
-
addl_fields["
|
63
|
-
addl_fields["
|
64
|
-
addl_fields["
|
65
|
-
addl_fields["
|
66
|
-
addl_fields["
|
67
|
-
addl_fields["
|
68
|
-
addl_fields["
|
61
|
+
addl_fields["id"] = [node.xpath("//eadid").text, node.attr("id")].join
|
62
|
+
addl_fields[Solrizer.solr_name("ead", :stored_sortable)] = node.xpath("//eadid").text
|
63
|
+
addl_fields[Solrizer.solr_name("parent", :stored_sortable)] = node.parent.attr("id") unless node.parent.attr("id").nil?
|
64
|
+
addl_fields[Solrizer.solr_name("parent", :displayable)] = parent_id_list(node)
|
65
|
+
addl_fields[Solrizer.solr_name("parent_unittitles", :displayable)] = parent_unittitle_list(node)
|
66
|
+
addl_fields[Solrizer.solr_name("component_level", :type => :integer)] = parent_id_list(node).length + 1
|
67
|
+
addl_fields[Solrizer.solr_name("component_children", :type => :boolean)] = component_children?(node)
|
68
|
+
addl_fields[Solrizer.solr_name("collection", :facetable)] = node.xpath("//archdesc/did/unittitle").text
|
69
69
|
return addl_fields
|
70
70
|
end
|
71
71
|
|
data/lib/solr_ead/component.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
class SolrEad::Component
|
2
2
|
|
3
3
|
include OM::XML::Document
|
4
|
-
include
|
4
|
+
include OM::XML::TerminologyBasedSolrizer
|
5
5
|
|
6
6
|
# Define each term in your ead that you want put into the solr document
|
7
7
|
set_terminology do |t|
|
@@ -84,9 +84,21 @@ class SolrEad::Component
|
|
84
84
|
|
85
85
|
def to_solr(solr_doc = Hash.new)
|
86
86
|
super(solr_doc)
|
87
|
-
|
88
|
-
|
89
|
-
|
87
|
+
Solrizer.insert_field(solr_doc, "format", "Archival Item", :facetable)
|
88
|
+
heading = get_heading solr_doc[Solrizer.solr_name("parent_unittitles", :displayable)]
|
89
|
+
Solrizer.insert_field(solr_doc, "heading", heading, :displayable) unless heading.nil?
|
90
|
+
Solrizer.insert_field(solr_doc, "ref", self.ref.first.strip, :stored_sortable)
|
91
|
+
end
|
92
|
+
|
93
|
+
protected
|
94
|
+
|
95
|
+
def get_heading parent_titles = Array.new
|
96
|
+
return nil if parent_titles.nil?
|
97
|
+
if parent_titles.length > 0
|
98
|
+
[parent_titles, self.title.first].join(" >> ")
|
99
|
+
else
|
100
|
+
self.title.first
|
101
|
+
end
|
90
102
|
end
|
91
103
|
|
92
104
|
end
|
data/lib/solr_ead/document.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
class SolrEad::Document
|
2
2
|
|
3
3
|
include OM::XML::Document
|
4
|
-
include
|
4
|
+
include OM::XML::TerminologyBasedSolrizer
|
5
5
|
include SolrEad::OmBehaviors
|
6
6
|
|
7
7
|
# Define each term in your ead that you want put into the solr document
|
@@ -27,9 +27,9 @@ class SolrEad::Document
|
|
27
27
|
t.title_filing(:path=>"titleproper", :attributes=>{ :type => "filing" }, :index_as=>[:sortable])
|
28
28
|
t.title_num(:path=>"archdesc/did/unitid")
|
29
29
|
t.extent(:path=>"archdesc/did/physdesc/extent")
|
30
|
-
t.unitdate(:path=>"archdesc/did/unitdate[not(@type)]", :index_as=>[:
|
31
|
-
t.unitdate_bulk(:path=>"archdesc/did/unitdate[@type='bulk']", :index_as=>[:
|
32
|
-
t.unitdate_inclusive(:path=>"archdesc/did/unitdate[@type='inclusive']", :index_as=>[:
|
30
|
+
t.unitdate(:path=>"archdesc/did/unitdate[not(@type)]", :index_as=>[:searchable])
|
31
|
+
t.unitdate_bulk(:path=>"archdesc/did/unitdate[@type='bulk']", :index_as=>[:searchable])
|
32
|
+
t.unitdate_inclusive(:path=>"archdesc/did/unitdate[@type='inclusive']", :index_as=>[:searchable])
|
33
33
|
t.language(:path=>"archdesc/did/langmaterial", :index_as=>[:displayable])
|
34
34
|
t.langcode(:path=>"did/langmaterial/language/@langcode")
|
35
35
|
t.abstract(:path=>"archdesc/did/abstract", :index_as=>[:searchable])
|
@@ -78,9 +78,12 @@ class SolrEad::Document
|
|
78
78
|
def to_solr(solr_doc = Hash.new)
|
79
79
|
super(solr_doc)
|
80
80
|
solr_doc.merge!({"id" => self.eadid.first.strip})
|
81
|
-
|
82
|
-
|
83
|
-
|
81
|
+
Solrizer.insert_field(solr_doc, "format", "Archival Collection", :facetable)
|
82
|
+
Solrizer.insert_field(solr_doc, "ead", self.eadid.first.strip, :stored_sortable)
|
83
|
+
unless self.title_num.empty?
|
84
|
+
heading = "Guide to the " + self.title.first + " (" + self.title_num.first + ")"
|
85
|
+
Solrizer.insert_field(solr_doc, "heading", heading, :displayable)
|
86
|
+
end
|
84
87
|
return solr_doc
|
85
88
|
end
|
86
89
|
|
data/lib/solr_ead/indexer.rb
CHANGED
@@ -39,28 +39,14 @@ class Indexer
|
|
39
39
|
attr_accessor :solr, :options
|
40
40
|
|
41
41
|
# Creates a new instance of SolrEad::Indexer and connects to your solr server
|
42
|
-
|
43
|
-
|
44
|
-
Solrizer.default_field_mapper = EadMapper.new
|
45
|
-
if ENV['SOLR_URL']
|
46
|
-
url = ENV['SOLR_URL']
|
47
|
-
elsif defined?(Rails.root)
|
48
|
-
url = YAML.load(ERB.new(File.read(File.join(Rails.root,"config","solr.yml"))).result)[Rails.env]['url']
|
49
|
-
elsif ENV['RAILS_ENV']
|
50
|
-
url = YAML.load(ERB.new(File.read("config/solr.yml")).result)[ENV['RAILS_ENV']]['url']
|
51
|
-
else
|
52
|
-
url = YAML.load(ERB.new(File.read("config/solr.yml")).result)['development']['url']
|
53
|
-
end
|
54
|
-
self.solr = RSolr.connect :url => url
|
42
|
+
def initialize opts={}
|
43
|
+
self.solr = solr_connection
|
55
44
|
self.options = opts
|
56
45
|
end
|
57
46
|
|
58
|
-
# Indexes
|
59
|
-
|
60
|
-
|
61
|
-
doc = om_document(File.new(file))
|
62
|
-
solr_doc = doc.to_solr
|
63
|
-
solr.add solr_doc
|
47
|
+
# Indexes ead xml and commits the results to your solr server.
|
48
|
+
def create file
|
49
|
+
solr.add om_document(File.new(file)).to_solr
|
64
50
|
add_components(file) unless options[:simple]
|
65
51
|
solr.commit
|
66
52
|
end
|
@@ -68,10 +54,9 @@ class Indexer
|
|
68
54
|
# Updates your ead from a given file by first deleting the existing ead document and
|
69
55
|
# any component documents, then creating a new index from the supplied file.
|
70
56
|
# This method will also commit the results to your solr server when complete.
|
71
|
-
def update
|
72
|
-
|
73
|
-
solr_doc
|
74
|
-
solr.delete_by_query( 'ead_id:"' + solr_doc["id"] + '"' )
|
57
|
+
def update file
|
58
|
+
solr_doc = om_document(File.new(file)).to_solr
|
59
|
+
delete solr_doc["id"]
|
75
60
|
solr.add solr_doc
|
76
61
|
add_components(file) unless options[:simple]
|
77
62
|
solr.commit
|
@@ -79,19 +64,19 @@ class Indexer
|
|
79
64
|
|
80
65
|
# Deletes the ead document and any component documents from your solr index and
|
81
66
|
# commits the results.
|
82
|
-
def delete
|
83
|
-
solr.delete_by_query( '
|
67
|
+
def delete id
|
68
|
+
solr.delete_by_query( Solrizer.solr_name("ead", :stored_sortable)+':"' + id + '"')
|
84
69
|
solr.commit
|
85
70
|
end
|
86
71
|
|
87
|
-
|
72
|
+
private
|
88
73
|
|
89
74
|
# Returns an OM document from a given file.
|
90
75
|
#
|
91
76
|
# Determines if you have specified a custom definition for your ead document.
|
92
77
|
# If you've defined a class CustomDocument, and have passed it as an option
|
93
78
|
# to your indexer, then SolrEad will use that class instead of SolrEad::Document.
|
94
|
-
def om_document
|
79
|
+
def om_document file
|
95
80
|
options[:document] ? options[:document].from_xml(File.new(file)) : SolrEad::Document.from_xml(File.new(file))
|
96
81
|
end
|
97
82
|
|
@@ -100,7 +85,7 @@ class Indexer
|
|
100
85
|
# Determines if you have specified a custom definition for your ead component.
|
101
86
|
# If you've defined a class CustomComponent, and have passed it as an option
|
102
87
|
# to your indexer, then SolrEad will use that class instead of SolrEad::Component.
|
103
|
-
def om_component_from_node
|
88
|
+
def om_component_from_node node
|
104
89
|
options[:component] ? options[:component].from_xml(prep(node)) : SolrEad::Component.from_xml(prep(node))
|
105
90
|
end
|
106
91
|
|
@@ -117,15 +102,34 @@ class Indexer
|
|
117
102
|
# A sorting field *sort_i* is added to the document using the index values from the array
|
118
103
|
# of <c> nodes. This allows us to preserve the order of <c> nodes as they appear
|
119
104
|
# in the original ead document.
|
120
|
-
def add_components
|
121
|
-
counter = 1
|
105
|
+
def add_components file, counter = 1
|
122
106
|
components(file).each do |node|
|
123
107
|
solr_doc = om_component_from_node(node).to_solr(additional_component_fields(node))
|
124
|
-
solr_doc.merge!({"
|
108
|
+
solr_doc.merge!({Solrizer.solr_name("sort", :sortable, :type => :integer) => counter.to_s})
|
125
109
|
solr.add solr_doc
|
126
110
|
counter = counter + 1
|
127
111
|
end
|
128
112
|
end
|
129
113
|
|
114
|
+
# Returns a connection to solr using Rsolr
|
115
|
+
def solr_connection
|
116
|
+
if ENV['SOLR_URL']
|
117
|
+
RSolr.connect :url => ENV['SOLR_URL']
|
118
|
+
else
|
119
|
+
RSolr.connect :url => solr_url
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
# Determines the url to our solr service by consulting yaml files
|
124
|
+
def solr_url
|
125
|
+
if defined?(Rails.root)
|
126
|
+
YAML.load(ERB.new(File.read(File.join(Rails.root,"config","solr.yml"))).result)[Rails.env]['url']
|
127
|
+
elsif ENV['RAILS_ENV']
|
128
|
+
YAML.load(ERB.new(File.read("config/solr.yml")).result)[ENV['RAILS_ENV']]['url']
|
129
|
+
else
|
130
|
+
YAML.load(ERB.new(File.read("config/solr.yml")).result)['development']['url']
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
130
134
|
end
|
131
135
|
end
|
data/lib/solr_ead/version.rb
CHANGED
data/lib/solr_ead.rb
CHANGED
@@ -1,19 +1,21 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require 'nokogiri'
|
2
|
+
require 'solrizer'
|
3
|
+
require 'om'
|
4
|
+
require 'rsolr'
|
5
|
+
require 'active_support'
|
5
6
|
|
6
7
|
module SolrEad
|
8
|
+
extend ActiveSupport::Autoload
|
9
|
+
|
10
|
+
autoload :Behaviors
|
11
|
+
autoload :OmBehaviors
|
12
|
+
autoload :Indexer
|
13
|
+
autoload :Document
|
14
|
+
autoload :Component
|
15
|
+
autoload :Railtie if defined?(Rails)
|
16
|
+
|
17
|
+
|
7
18
|
def self.version
|
8
19
|
SolrEad::VERSION
|
9
20
|
end
|
10
|
-
end
|
11
|
-
|
12
|
-
require "ead_mapper"
|
13
|
-
require "solr_ead/behaviors"
|
14
|
-
require "solr_ead/om_behaviors"
|
15
|
-
require "solr_ead/indexer"
|
16
|
-
require "solr_ead/document"
|
17
|
-
require "solr_ead/component"
|
18
|
-
|
19
|
-
require 'solr_ead/railtie' if defined?(Rails)
|
21
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
desc "Travis continuous integration task"
|
2
|
+
task :ci do
|
3
|
+
Rake::Task["jetty:stop"].invoke
|
4
|
+
Rake::Task["jetty:clean"].invoke
|
5
|
+
Rake::Task["jetty:start"].invoke
|
6
|
+
Rake::Task["spec"].invoke
|
7
|
+
end
|
8
|
+
|
9
|
+
namespace :jetty do
|
10
|
+
|
11
|
+
desc "Unpack a clean version of solr-jetty"
|
12
|
+
task :clean do
|
13
|
+
Jettywrapper.url = "https://github.com/awead/solr-jetty/archive/v1.zip"
|
14
|
+
Jettywrapper.clean
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Configure solr-jetty instance"
|
18
|
+
task :config do
|
19
|
+
`cp solr/schema.xml jetty/solr/blacklight-dev-core/conf/schema.xml`
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|