dor-services 5.3.4 → 5.4.0
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/config/config_defaults.yml +1 -4
- data/config/dev_console_env.rb.example +1 -2
- data/lib/dor/config.rb +20 -28
- data/lib/dor/datastreams/workflow_ds.rb +2 -3
- data/lib/dor/models/identifiable.rb +9 -4
- data/lib/dor/models/publishable.rb +4 -3
- data/lib/dor/services/search_service.rb +0 -22
- data/lib/dor/version.rb +1 -1
- metadata +31 -5
- data/lib/gsearch/demoFoxmlToSolr.xslt +0 -602
- data/lib/gsearch/schema.xml +0 -229
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9a88f0d0bd7ef08c38ddb485d4207398f9c9d82
|
4
|
+
data.tar.gz: 0908b1eaf6a8b92e1f3e66c8fb91ae0f38d5fcfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 899c1855ff906efcac21cccf89af369e88faaac71ac6b53e21ee2dd224252331d903135cd61d30ecdaba32ca138baf28b4b2f17f213a858b7235eb7256851bf7
|
7
|
+
data.tar.gz: d2a357095da5f7e320844f3f7f069e62d8f616a38d68229a4128d0ba1f1f093aaa8b91d1b9b3f9ba4da15a43f53646905b20997bac67309710090c44d12359eb
|
data/config/config_defaults.yml
CHANGED
@@ -37,8 +37,7 @@ Dor::Config.configure do
|
|
37
37
|
local_document_cache_root '/purl'
|
38
38
|
end
|
39
39
|
|
40
|
-
|
41
|
-
solrizer.url 'https://host/solr'
|
40
|
+
solr.url 'https://host/solr'
|
42
41
|
workflow.url 'https://host/workflow/'
|
43
42
|
dor_services.url 'https://host/dor/v1'
|
44
43
|
|
data/lib/dor/config.rb
CHANGED
@@ -55,8 +55,10 @@ module Dor
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def make_solr_connection(add_opts = {})
|
58
|
-
|
59
|
-
|
58
|
+
c = Dor::Config.solr || Dor::Config.solrizer
|
59
|
+
|
60
|
+
opts = c.opts.merge(add_opts).merge(
|
61
|
+
:url => c.url
|
60
62
|
)
|
61
63
|
::RSolr::Ext.connect(opts)
|
62
64
|
end
|
@@ -75,12 +77,11 @@ module Dor
|
|
75
77
|
end
|
76
78
|
}
|
77
79
|
},
|
78
|
-
:
|
79
|
-
:rest_client => Confstruct.deferred { |c| config.make_rest_client c.url }
|
80
|
+
:dor_services => {
|
81
|
+
:rest_client => Confstruct.deferred { |c| config.make_rest_client c.url, c.cert_file, c.key_file, c.key_pass }
|
80
82
|
},
|
81
|
-
:
|
82
|
-
:rest_client => Confstruct.deferred { |c| config.make_rest_client c.
|
83
|
-
:client => Confstruct.deferred { |c| config.make_rest_client c.url }
|
83
|
+
:sdr => {
|
84
|
+
:rest_client => Confstruct.deferred { |c| config.make_rest_client c.url, c.cert_file, c.key_file, c.key_pass }
|
84
85
|
},
|
85
86
|
:stomp => {
|
86
87
|
:connection => Confstruct.deferred { |c| Stomp::Connection.new c.user, c.password, c.host, c.port, true, 5, { 'client-id' => c.client_id }},
|
@@ -102,26 +103,17 @@ module Dor
|
|
102
103
|
config.fedora.delete(key)
|
103
104
|
end
|
104
105
|
|
105
|
-
if
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
end
|
110
|
-
else
|
111
|
-
ActiveFedora::RubydoraConnection.connect fedora_config if fedora.url.present?
|
112
|
-
if solrizer.url.present?
|
113
|
-
ActiveFedora::SolrService.register config.solrizer.url, config.solrizer.opts
|
114
|
-
conn = ActiveFedora::SolrService.instance.conn.connection
|
115
|
-
if config.ssl.cert_file.present?
|
116
|
-
conn.use_ssl = true
|
117
|
-
conn.cert = OpenSSL::X509::Certificate.new(File.read(config.ssl.cert_file))
|
118
|
-
conn.key = OpenSSL::PKey::RSA.new(File.read(config.ssl.key_file), config.ssl.key_pass) if config.ssl.key_file.present?
|
119
|
-
conn.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
120
|
-
end
|
121
|
-
end
|
122
|
-
ActiveFedora.init
|
123
|
-
ActiveFedora.fedora_config_path = File.expand_path('../../../config/dummy.yml', __FILE__)
|
106
|
+
if config.solrizer.present?
|
107
|
+
stack = Kernel.caller.dup
|
108
|
+
stack.shift while stack[0] =~ %r{(active_support/callbacks|dor/config|dor-services)\.rb}
|
109
|
+
ActiveSupport::Deprecation.warn "Dor::Config -- solrizer configuration is deprecated. Please use solr instead.", stack
|
124
110
|
end
|
111
|
+
|
112
|
+
if (config.solr || config.solrizer).url.present?
|
113
|
+
ActiveFedora::SolrService.register
|
114
|
+
ActiveFedora::SolrService.instance.instance_variable_set :@conn, make_solr_connection
|
115
|
+
end
|
116
|
+
|
125
117
|
end
|
126
118
|
|
127
119
|
# Act like an ActiveFedora.configurator
|
@@ -137,7 +129,7 @@ module Dor
|
|
137
129
|
end
|
138
130
|
|
139
131
|
def solr_config
|
140
|
-
{ :url => solrizer.url }
|
132
|
+
{ :url => (solr || solrizer).url }
|
141
133
|
end
|
142
134
|
|
143
135
|
def predicate_config
|
@@ -146,5 +138,5 @@ module Dor
|
|
146
138
|
end
|
147
139
|
|
148
140
|
Config = Configuration.new(YAML.load(File.read(File.expand_path('../../../config/config_defaults.yml', __FILE__))))
|
149
|
-
ActiveFedora.configurator = Config
|
141
|
+
ActiveFedora.configurator = Config
|
150
142
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module Dor
|
2
2
|
# TODO: class docs
|
3
3
|
class WorkflowDs < ActiveFedora::OmDatastream
|
4
|
-
|
5
4
|
set_terminology do |t|
|
6
5
|
t.root(:path => 'workflows')
|
7
6
|
t.workflow {
|
@@ -9,7 +8,7 @@ module Dor
|
|
9
8
|
t.process {
|
10
9
|
t.name_( :path => {:attribute => 'name' }, :index_as => [:displayable, :not_searchable] )
|
11
10
|
t.status( :path => {:attribute => 'status' }, :index_as => [:displayable, :not_searchable] )
|
12
|
-
t.timestamp(:path => {:attribute => 'datetime' }, :index_as => [:displayable, :not_searchable] )
|
11
|
+
t.timestamp(:path => {:attribute => 'datetime' }, :index_as => [:displayable, :not_searchable] ) #, :data_type => :date)
|
13
12
|
t.elapsed( :path => {:attribute => 'elapsed' }, :index_as => [:displayable, :not_searchable] )
|
14
13
|
t.lifecycle(:path => {:attribute => 'lifecycle'}, :index_as => [:displayable, :not_searchable] )
|
15
14
|
t.attempts( :path => {:attribute => 'attempts' }, :index_as => [:displayable, :not_searchable] )
|
@@ -24,7 +23,7 @@ module Dor
|
|
24
23
|
Workflow::Document.new(xml.to_s)
|
25
24
|
end
|
26
25
|
|
27
|
-
|
26
|
+
alias :[] :get_workflow
|
28
27
|
|
29
28
|
def ng_xml
|
30
29
|
@ng_xml ||= Nokogiri::XML::Document.parse(content)
|
@@ -233,10 +233,15 @@ module Dor
|
|
233
233
|
|
234
234
|
# populate cache if necessary
|
235
235
|
unless title_hash.key?(rel_druid)
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
236
|
+
begin
|
237
|
+
related_obj = Dor.find(rel_druid)
|
238
|
+
related_obj_title = get_related_obj_display_title(related_obj, rel_druid)
|
239
|
+
is_from_hydrus = (related_obj && related_obj.tags.include?('Project : Hydrus'))
|
240
|
+
title_hash[rel_druid] = {'related_obj_title' => related_obj_title, 'is_from_hydrus' => is_from_hydrus}
|
241
|
+
rescue ActiveFedora::ObjectNotFoundError
|
242
|
+
# This may happen if the given APO or Collection does not exist (bad data)
|
243
|
+
title_hash[rel_druid] = {'related_obj_title' => rel_druid, 'is_from_hydrus' => false}
|
244
|
+
end
|
240
245
|
end
|
241
246
|
|
242
247
|
# cache should definitely be populated, so just use that to write solr field
|
@@ -69,9 +69,10 @@ module Dor
|
|
69
69
|
|
70
70
|
# Call dor services app to have it publish the metadata
|
71
71
|
def publish_metadata_remotely
|
72
|
-
dor_services =
|
73
|
-
dor_services
|
74
|
-
|
72
|
+
dor_services = Dor::Config.dor_services.rest_client
|
73
|
+
endpoint = dor_services["v1/objects/#{pid}/publish"]
|
74
|
+
endpoint.post ''
|
75
|
+
endpoint.url
|
75
76
|
end
|
76
77
|
end
|
77
78
|
end
|
@@ -13,15 +13,6 @@ module Dor
|
|
13
13
|
Dor::VERSION
|
14
14
|
end
|
15
15
|
|
16
|
-
def reindex(*pids)
|
17
|
-
client = Config.gsearch.rest_client
|
18
|
-
pids.in_groups_of(20, false) do |group|
|
19
|
-
group.each { |pid| client["?operation=updateIndex&action=fromPid&value=#{pid}"].get }
|
20
|
-
yield group if block_given?
|
21
|
-
end
|
22
|
-
pids
|
23
|
-
end
|
24
|
-
|
25
16
|
def risearch(query, opts = {})
|
26
17
|
client = Config.fedora.client['risearch']
|
27
18
|
client.options[:timeout] = opts.delete(:timeout)
|
@@ -54,19 +45,6 @@ module Dor
|
|
54
45
|
end
|
55
46
|
end
|
56
47
|
|
57
|
-
def gsearch(params)
|
58
|
-
client = Config.gsearch.client
|
59
|
-
query_params = params.merge(:wt => 'json')
|
60
|
-
query_string = query_params.collect { |k, v|
|
61
|
-
if v.is_a?(Array)
|
62
|
-
v.collect { |vv| "#{k}=#{URI.encode(vv.to_s)}" }.join('&')
|
63
|
-
else
|
64
|
-
"#{k}=#{URI.encode(v.to_s)}"
|
65
|
-
end
|
66
|
-
}.join('&')
|
67
|
-
JSON.parse(client["select?#{query_string}"].get)
|
68
|
-
end
|
69
|
-
|
70
48
|
def query(query, args = {})
|
71
49
|
params = args.merge({ :q => query })
|
72
50
|
params[:start] ||= 0
|
data/lib/dor/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dor-services
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Klein
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date: 2016-02-
|
17
|
+
date: 2016-02-20 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: active-fedora
|
@@ -552,6 +552,34 @@ dependencies:
|
|
552
552
|
- - ">="
|
553
553
|
- !ruby/object:Gem::Version
|
554
554
|
version: '0'
|
555
|
+
- !ruby/object:Gem::Dependency
|
556
|
+
name: vcr
|
557
|
+
requirement: !ruby/object:Gem::Requirement
|
558
|
+
requirements:
|
559
|
+
- - ">="
|
560
|
+
- !ruby/object:Gem::Version
|
561
|
+
version: '0'
|
562
|
+
type: :development
|
563
|
+
prerelease: false
|
564
|
+
version_requirements: !ruby/object:Gem::Requirement
|
565
|
+
requirements:
|
566
|
+
- - ">="
|
567
|
+
- !ruby/object:Gem::Version
|
568
|
+
version: '0'
|
569
|
+
- !ruby/object:Gem::Dependency
|
570
|
+
name: webmock
|
571
|
+
requirement: !ruby/object:Gem::Requirement
|
572
|
+
requirements:
|
573
|
+
- - ">="
|
574
|
+
- !ruby/object:Gem::Version
|
575
|
+
version: '0'
|
576
|
+
type: :development
|
577
|
+
prerelease: false
|
578
|
+
version_requirements: !ruby/object:Gem::Requirement
|
579
|
+
requirements:
|
580
|
+
- - ">="
|
581
|
+
- !ruby/object:Gem::Version
|
582
|
+
version: '0'
|
555
583
|
- !ruby/object:Gem::Dependency
|
556
584
|
name: yard
|
557
585
|
requirement: !ruby/object:Gem::Requirement
|
@@ -651,8 +679,6 @@ files:
|
|
651
679
|
- lib/dor/workflow/document.rb
|
652
680
|
- lib/dor/workflow/graph.rb
|
653
681
|
- lib/dor/workflow/process.rb
|
654
|
-
- lib/gsearch/demoFoxmlToSolr.xslt
|
655
|
-
- lib/gsearch/schema.xml
|
656
682
|
- lib/tasks/rdoc.rake
|
657
683
|
homepage:
|
658
684
|
licenses:
|
@@ -675,7 +701,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
675
701
|
version: 1.3.6
|
676
702
|
requirements: []
|
677
703
|
rubyforge_project:
|
678
|
-
rubygems_version: 2.4.
|
704
|
+
rubygems_version: 2.4.5.1
|
679
705
|
signing_key:
|
680
706
|
specification_version: 4
|
681
707
|
summary: Ruby implmentation of DOR services used by the SULAIR Digital Library
|
@@ -1,602 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<!-- $Id: demoFoxmlToLucene.xslt 5734 2006-11-28 11:20:15Z gertsp $ -->
|
3
|
-
<xsl:stylesheet version="1.0"
|
4
|
-
exclude-result-prefixes="dc dt ex exts fedora-model fedora-types fn foxml hydra oai_dc rdf rel uvalibadmin uvalibdesc xsl"
|
5
|
-
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
6
|
-
xmlns:exts="xalan://dk.defxws.fedoragsearch.server.GenericOperationsImpl"
|
7
|
-
xmlns:ex="http://exslt.org/common"
|
8
|
-
xmlns:dt="http://exslt.org/dates-and-times"
|
9
|
-
xmlns:fedora-model="info:fedora/fedora-system:def/model#"
|
10
|
-
xmlns:fedora-types="http://www.fedora.info/definitions/1/0/types/"
|
11
|
-
xmlns:fn="http://www.w3.org/TR/xpath-functions/"
|
12
|
-
xmlns:foxml="info:fedora/fedora-system:def/foxml#"
|
13
|
-
xmlns:hydra="http://projecthydra.org/ns/relations#" xmlns:mods="http://www.loc.gov/mods/v3"
|
14
|
-
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
|
15
|
-
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
16
|
-
xmlns:rel="info:fedora/fedora-system:def/relations-external#"
|
17
|
-
xmlns:uvalibadmin="http://dl.lib.virginia.edu/bin/admin/admin.dtd/"
|
18
|
-
xmlns:uvalibdesc="http://dl.lib.virginia.edu/bin/dtd/descmeta/descmeta.dtd"
|
19
|
-
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:zs="http://www.loc.gov/zing/srw/">
|
20
|
-
<xsl:output encoding="UTF-8" indent="yes" method="xml"/>
|
21
|
-
<!--
|
22
|
-
This xslt stylesheet generates the Solr doc element consisting of field elements
|
23
|
-
from a FOXML record. The PID field is mandatory.
|
24
|
-
Options for tailoring:
|
25
|
-
- generation of fields from other XML metadata streams than DC
|
26
|
-
- generation of fields from other datastream types than XML
|
27
|
-
- from datastream by ID, text fetched, if mimetype can be handled
|
28
|
-
currently the mimetypes text/plain, text/xml, text/html, application/pdf can be handled.
|
29
|
-
-->
|
30
|
-
<xsl:variable name="INDEXVERSION">2.2.0</xsl:variable>
|
31
|
-
|
32
|
-
<xsl:param name="INCLUDE_EXTERNALS" select="true()"/>
|
33
|
-
<xsl:param name="REPOSITORYNAME" select="repositoryName"/>
|
34
|
-
<xsl:param name="FEDORASOAP" select="repositoryName"/>
|
35
|
-
<xsl:param name="FEDORAUSER" select="repositoryName"/>
|
36
|
-
<xsl:param name="FEDORAPASS" select="repositoryName"/>
|
37
|
-
<xsl:param name="TRUSTSTOREPATH" select="repositoryName"/>
|
38
|
-
<xsl:param name="TRUSTSTOREPASS" select="repositoryName"/>
|
39
|
-
<xsl:variable name="PID" select="/foxml:digitalObject/@PID"/>
|
40
|
-
<xsl:variable name="docBoost" select="1.4*2.5"/>
|
41
|
-
<xsl:variable name="OBJECTTYPE"
|
42
|
-
select="//foxml:datastream/foxml:datastreamVersion[last()]//identityMetadata/objectType/text()"/>
|
43
|
-
<xsl:variable name="first-workflow-url">
|
44
|
-
<xsl:value-of select="//foxml:contentLocation[@TYPE='URL' and contains(@REF, 'workflow/dor/objects')]/@REF"/>
|
45
|
-
</xsl:variable>
|
46
|
-
<xsl:variable name="workflow-stem">
|
47
|
-
<xsl:value-of select="substring-before($first-workflow-url, $PID)"/>
|
48
|
-
</xsl:variable>
|
49
|
-
<xsl:variable name="DATASTREAM_LIST">
|
50
|
-
<ds name="RELS-EXT"/>
|
51
|
-
<ds name="DC"/>
|
52
|
-
<ds name="identityMetadata"/>
|
53
|
-
<ds name="descMetadata"/>
|
54
|
-
<ds name="embargoMetadata"/>
|
55
|
-
<ds name="administrativeMetadata"/>
|
56
|
-
<ds name="roleMetadata"/>
|
57
|
-
<ds name="contentMetadata"/>
|
58
|
-
<ds name="rightsMetadata"/>
|
59
|
-
<ds name="workflows"/>
|
60
|
-
<!--<ds match="WF"/>-->
|
61
|
-
</xsl:variable>
|
62
|
-
|
63
|
-
<!-- or any other calculation, default boost is 1.0 -->
|
64
|
-
<xsl:template match="/">
|
65
|
-
<add>
|
66
|
-
<doc boost="{$docBoost}">
|
67
|
-
<xsl:apply-templates/>
|
68
|
-
</doc>
|
69
|
-
</add>
|
70
|
-
</xsl:template>
|
71
|
-
|
72
|
-
<xsl:template match="/foxml:digitalObject">
|
73
|
-
<field name="index_version_field">
|
74
|
-
<xsl:value-of select="$INDEXVERSION"/>
|
75
|
-
</field>
|
76
|
-
<field boost="2.5" name="PID">
|
77
|
-
<xsl:value-of select="$PID"/>
|
78
|
-
</field>
|
79
|
-
<field name="namespace_field">
|
80
|
-
<xsl:value-of select="substring-before($PID,':')"/>
|
81
|
-
</field>
|
82
|
-
<field name="namespace_facet">
|
83
|
-
<xsl:value-of select="substring-before($PID,':')"/>
|
84
|
-
</field>
|
85
|
-
<field name="link_text_display">
|
86
|
-
<xsl:choose>
|
87
|
-
<xsl:when test="//dc:title">
|
88
|
-
<xsl:value-of select="//dc:title/text()"/>
|
89
|
-
</xsl:when>
|
90
|
-
<xsl:otherwise>
|
91
|
-
<xsl:value-of select="$PID"/>
|
92
|
-
</xsl:otherwise>
|
93
|
-
</xsl:choose>
|
94
|
-
</field>
|
95
|
-
<xsl:call-template name="lifecycle"/>
|
96
|
-
<xsl:apply-templates select="*"/>
|
97
|
-
<xsl:call-template name="workflows"/>
|
98
|
-
</xsl:template>
|
99
|
-
|
100
|
-
<xsl:template match="foxml:objectProperties/foxml:property">
|
101
|
-
<field>
|
102
|
-
<xsl:attribute name="name">
|
103
|
-
<!-- if this is a data field, append with date, otherwise field -->
|
104
|
-
<xsl:choose>
|
105
|
-
<xsl:when test="contains(@NAME, 'Date')">
|
106
|
-
<xsl:value-of select="concat('fgs_', substring-after(@NAME,'#'), '_date')"/>
|
107
|
-
</xsl:when>
|
108
|
-
<xsl:otherwise>
|
109
|
-
<xsl:value-of select="concat('fgs_', substring-after(@NAME,'#'), '_field')"
|
110
|
-
/>
|
111
|
-
</xsl:otherwise>
|
112
|
-
</xsl:choose>
|
113
|
-
</xsl:attribute>
|
114
|
-
<xsl:value-of select="@VALUE"/>
|
115
|
-
</field>
|
116
|
-
</xsl:template>
|
117
|
-
|
118
|
-
<xsl:template match="foxml:datastream">
|
119
|
-
<field name="fedora_datastream_version_field">
|
120
|
-
<xsl:value-of select="foxml:datastreamVersion[last()]/@ID"/>
|
121
|
-
</field>
|
122
|
-
<xsl:apply-templates select="foxml:datastreamVersion[last()]"/>
|
123
|
-
</xsl:template>
|
124
|
-
|
125
|
-
<!-- Index inline datastreams -->
|
126
|
-
<xsl:template match="foxml:datastream[foxml:datastreamVersion/foxml:xmlContent]/foxml:datastreamVersion[last()]">
|
127
|
-
<xsl:variable name="datastream-name" select="../@ID"/>
|
128
|
-
<xsl:apply-templates select="foxml:xmlContent/*">
|
129
|
-
<xsl:with-param name="datastream-name" select="$datastream-name"/>
|
130
|
-
</xsl:apply-templates>
|
131
|
-
</xsl:template>
|
132
|
-
|
133
|
-
<!-- Index managed/external datastreams -->
|
134
|
-
<xsl:template match="foxml:datastream[foxml:datastreamVersion/foxml:contentLocation]/foxml:datastreamVersion[last()]">
|
135
|
-
<xsl:if test="$INCLUDE_EXTERNALS">
|
136
|
-
<xsl:variable name="ds" select="."/>
|
137
|
-
<xsl:call-template name="process-datastream">
|
138
|
-
<xsl:with-param name="ds" select="$ds"/>
|
139
|
-
<xsl:with-param name="datastreams" select="ex:node-set($DATASTREAM_LIST)"/>
|
140
|
-
</xsl:call-template>
|
141
|
-
</xsl:if>
|
142
|
-
</xsl:template>
|
143
|
-
|
144
|
-
<xsl:template name="process-datastream">
|
145
|
-
<xsl:param name="ds"/>
|
146
|
-
<xsl:param name="datastreams"/>
|
147
|
-
<xsl:variable name="datastream-name" select="$ds/../@ID"/>
|
148
|
-
<xsl:variable name="datastream-ts" select="$ds/@CREATED"/>
|
149
|
-
<xsl:variable name="content-location" select="$ds/foxml:contentLocation/@REF"/>
|
150
|
-
<xsl:for-each select="$datastreams/*">
|
151
|
-
<xsl:if test="(@name and (@name = $datastream-name)) or (@match and contains($datastream-name,@match))">
|
152
|
-
<xsl:variable name="content-uri">
|
153
|
-
<xsl:choose>
|
154
|
-
<xsl:when test="contains($content-location, '/fedora/get/')">http://localhost:8080/fedora/<xsl:value-of select="substring-after($content-location,'/fedora/')"/></xsl:when>
|
155
|
-
<xsl:otherwise><xsl:value-of select="$content-location"/></xsl:otherwise>
|
156
|
-
</xsl:choose>
|
157
|
-
</xsl:variable>
|
158
|
-
<xsl:message>Retrieving <xsl:value-of select="$content-uri"/></xsl:message>
|
159
|
-
<xsl:apply-templates select="document($content-uri)/*">
|
160
|
-
<xsl:with-param name="datastream-name" select="$datastream-name"/>
|
161
|
-
</xsl:apply-templates>
|
162
|
-
</xsl:if>
|
163
|
-
</xsl:for-each>
|
164
|
-
</xsl:template>
|
165
|
-
|
166
|
-
<xsl:template name="workflows">
|
167
|
-
<xsl:variable name="combined-workflow-stream" select="document(concat($workflow-stem,$PID,'/workflows'))"/>
|
168
|
-
<xsl:apply-templates select="$combined-workflow-stream/workflows/workflow"/>
|
169
|
-
</xsl:template>
|
170
|
-
|
171
|
-
<!-- Index RELS-EXT -->
|
172
|
-
<xsl:template match="rdf:RDF/rdf:Description">
|
173
|
-
<!-- Grab the cmodel -->
|
174
|
-
<xsl:for-each select="./fedora-model:hasModel">
|
175
|
-
<field name="fedora_has_model_field">
|
176
|
-
<xsl:value-of select="@rdf:resource"/>
|
177
|
-
</field>
|
178
|
-
</xsl:for-each>
|
179
|
-
<xsl:for-each select="*[@rdf:resource]">
|
180
|
-
<xsl:variable name="doc-pid" select="substring-after(./@rdf:resource,'info:fedora/')"/>
|
181
|
-
<field name="{local-name(.)}_id_field">
|
182
|
-
<xsl:value-of select="$doc-pid"/>
|
183
|
-
</field>
|
184
|
-
<field name="{local-name(.)}_id_facet">
|
185
|
-
<xsl:value-of select="$doc-pid"/>
|
186
|
-
</field>
|
187
|
-
</xsl:for-each>
|
188
|
-
</xsl:template>
|
189
|
-
|
190
|
-
<!-- Index DC -->
|
191
|
-
<xsl:template match="oai_dc:dc">
|
192
|
-
<xsl:for-each select="dc:title|dc:creator|dc:identifier">
|
193
|
-
<field name="dc_{local-name(.)}_text">
|
194
|
-
<xsl:value-of select="text()"/>
|
195
|
-
</field>
|
196
|
-
</xsl:for-each>
|
197
|
-
<xsl:for-each select="./*">
|
198
|
-
<field name="dc_{local-name(.)}_field">
|
199
|
-
<xsl:value-of select="text()"/>
|
200
|
-
</field>
|
201
|
-
</xsl:for-each>
|
202
|
-
</xsl:template>
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
<!-- Index identity metadata -->
|
207
|
-
<xsl:template match="identityMetadata">
|
208
|
-
<xsl:for-each select="./objectType">
|
209
|
-
<field name="object_type_field">
|
210
|
-
<xsl:value-of select="./text()"/>
|
211
|
-
</field>
|
212
|
-
</xsl:for-each>
|
213
|
-
<xsl:for-each select="./sourceId">
|
214
|
-
<field name="dor_id_field">
|
215
|
-
<xsl:value-of select="concat(@source, ':', normalize-space(./text()))"/>
|
216
|
-
</field>
|
217
|
-
<field name="source_id_field">
|
218
|
-
<xsl:value-of select="concat(@source, ':', normalize-space(./text()))"/>
|
219
|
-
</field>
|
220
|
-
<field name="identifier_text">
|
221
|
-
<xsl:value-of select="concat(@source, ':', normalize-space(./text()))"/>
|
222
|
-
</field>
|
223
|
-
<field name="identifier_text">
|
224
|
-
<xsl:value-of select="normalize-space(./text())"/>
|
225
|
-
</field>
|
226
|
-
</xsl:for-each>
|
227
|
-
<xsl:for-each select="./otherId">
|
228
|
-
<field name="dor_id_field">
|
229
|
-
<xsl:value-of select="concat(@name, ':', normalize-space(./text()))"/>
|
230
|
-
</field>
|
231
|
-
<field name="dor_{@name}_id_field">
|
232
|
-
<xsl:value-of select="normalize-space(./text())"/>
|
233
|
-
</field>
|
234
|
-
</xsl:for-each>
|
235
|
-
<!-- tags -->
|
236
|
-
<xsl:for-each select="./tag">
|
237
|
-
<xsl:variable name="text-value" select="normalize-space(./text())"/>
|
238
|
-
<field name="tag_field">
|
239
|
-
<xsl:value-of select="$text-value"/>
|
240
|
-
</field>
|
241
|
-
<field name="tag_facet">
|
242
|
-
<xsl:value-of select="$text-value"/>
|
243
|
-
</field>
|
244
|
-
<xsl:variable name="tag-name"
|
245
|
-
select="normalize-space(substring-before($text-value, ':'))"/>
|
246
|
-
<xsl:variable name="field-name">
|
247
|
-
<xsl:call-template name="valid-field-name">
|
248
|
-
<xsl:with-param name="name" select="$tag-name"/>
|
249
|
-
</xsl:call-template>
|
250
|
-
<xsl:text>_tag</xsl:text>
|
251
|
-
</xsl:variable>
|
252
|
-
<field name="{$field-name}_field">
|
253
|
-
<xsl:value-of select="normalize-space(substring-after($text-value, ':'))"/>
|
254
|
-
</field>
|
255
|
-
<field name="{$field-name}_facet">
|
256
|
-
<xsl:value-of select="normalize-space(substring-after($text-value, ':'))"/>
|
257
|
-
</field>
|
258
|
-
</xsl:for-each>
|
259
|
-
</xsl:template>
|
260
|
-
|
261
|
-
<!-- Index MODS descriptive metadata -->
|
262
|
-
<xsl:template match="mods:mods">
|
263
|
-
<field name="metadata_format_field">mods</field>
|
264
|
-
<field name="metadata_format_facet">mods</field>
|
265
|
-
<!-- Grab the MODS identifiers -->
|
266
|
-
<xsl:for-each select="./mods:identifier">
|
267
|
-
<xsl:variable name="identifier-label">
|
268
|
-
<xsl:call-template name="valid-field-name">
|
269
|
-
<xsl:with-param name="name" select="@displayLabel"/>
|
270
|
-
</xsl:call-template>
|
271
|
-
</xsl:variable>
|
272
|
-
<field name="mods_identifier_field">
|
273
|
-
<xsl:value-of select="@displayLabel"/>:<xsl:value-of select="text()"/>
|
274
|
-
</field>
|
275
|
-
<field name="mods_{$identifier-label}_identifier_field">
|
276
|
-
<xsl:value-of select="text()"/>
|
277
|
-
</field>
|
278
|
-
<field name="mods_identifier_text">
|
279
|
-
<xsl:value-of select="@displayLabel"/>:<xsl:value-of select="text()"/>
|
280
|
-
</field>
|
281
|
-
<field name="mods_{$identifier-label}_identifier_text">
|
282
|
-
<xsl:value-of select="text()"/>
|
283
|
-
</field>
|
284
|
-
</xsl:for-each>
|
285
|
-
<xsl:for-each select="mods:titleInfo">
|
286
|
-
<xsl:variable name="title-info">
|
287
|
-
<xsl:call-template name="mods-title"/>
|
288
|
-
</xsl:variable>
|
289
|
-
<field name="mods_titleInfo_field">
|
290
|
-
<xsl:value-of select="$title-info"/>
|
291
|
-
</field>
|
292
|
-
<field name="mods_title_text">
|
293
|
-
<xsl:value-of select="$title-info"/>
|
294
|
-
</field>
|
295
|
-
</xsl:for-each>
|
296
|
-
<xsl:for-each select="mods:name">
|
297
|
-
<xsl:variable name="name-info">
|
298
|
-
<xsl:call-template name="mods-name"/>
|
299
|
-
</xsl:variable>
|
300
|
-
<field name="mods_name_field">
|
301
|
-
<xsl:value-of select="$name-info"/>
|
302
|
-
</field>
|
303
|
-
<field name="mods_name_text">
|
304
|
-
<xsl:value-of select="$name-info"/>
|
305
|
-
</field>
|
306
|
-
<xsl:if test="mods:role/mods:roleTerm[@type='text']">
|
307
|
-
<xsl:variable name="role" select="mods:role/mods:roleTerm[@type='text']/text()"/>
|
308
|
-
<field name="mods_{$role}_field">
|
309
|
-
<xsl:value-of select="mods:namePart/text()"/>
|
310
|
-
</field>
|
311
|
-
<field name="mods_{$role}_text">
|
312
|
-
<xsl:value-of select="mods:namePart/text()"/>
|
313
|
-
</field>
|
314
|
-
</xsl:if>
|
315
|
-
</xsl:for-each>
|
316
|
-
<xsl:for-each select="mods:originInfo/mods:publisher">
|
317
|
-
<field name="mods_publisher_field">
|
318
|
-
<xsl:value-of select="text()"/>
|
319
|
-
</field>
|
320
|
-
<field name="mods_publisher_text">
|
321
|
-
<xsl:value-of select="text()"/>
|
322
|
-
</field>
|
323
|
-
</xsl:for-each>
|
324
|
-
<xsl:for-each select="mods:originInfo/mods:place/mods:placeTerm[@type='text']">
|
325
|
-
<field name="mods_origininfo_place_field">
|
326
|
-
<xsl:value-of select="text()"/>
|
327
|
-
</field>
|
328
|
-
<field name="mods_origininfo_place_text">
|
329
|
-
<xsl:value-of select="text()"/>
|
330
|
-
</field>
|
331
|
-
</xsl:for-each>
|
332
|
-
<!-- Index some, but not all, MODS fields -->
|
333
|
-
<xsl:for-each select="//mods:coordinates|//mods:extent|//mods:scale|//mods:topic">
|
334
|
-
<xsl:if test="./text()">
|
335
|
-
<field name="mods_{local-name(.)}_field">
|
336
|
-
<xsl:value-of select="text()"/>
|
337
|
-
</field>
|
338
|
-
</xsl:if>
|
339
|
-
</xsl:for-each>
|
340
|
-
<xsl:for-each
|
341
|
-
select="//mods:*[contains(local-name(),'date') or contains(local-name(), 'Date')]">
|
342
|
-
<xsl:variable name="date-label">
|
343
|
-
<xsl:call-template name="valid-field-name">
|
344
|
-
<xsl:with-param name="name" select="local-name()"/>
|
345
|
-
</xsl:call-template>
|
346
|
-
</xsl:variable>
|
347
|
-
<field name="mods_{$date-label}_field">
|
348
|
-
<xsl:value-of select="normalize-space(./text())"/>
|
349
|
-
</field>
|
350
|
-
</xsl:for-each>
|
351
|
-
<!--
|
352
|
-
<xsl:for-each select=".//mods:*[string-length(normalize-space(text())) > 0]">
|
353
|
-
<field name="mods_{local-name(.)}_field"><xsl:value-of select="normalize-space(./text())"/></field>
|
354
|
-
</xsl:for-each>
|
355
|
-
-->
|
356
|
-
</xsl:template>
|
357
|
-
|
358
|
-
<!-- mods-title and mods-name templates cribbed from mods2dc.xslt -->
|
359
|
-
<xsl:template name="mods-title">
|
360
|
-
<xsl:value-of select="mods:nonSort"/>
|
361
|
-
<xsl:if test="mods:nonSort">
|
362
|
-
|
363
|
-
<xsl:text> </xsl:text>
|
364
|
-
</xsl:if>
|
365
|
-
<xsl:value-of select="mods:title"/>
|
366
|
-
<xsl:if test="mods:subTitle">
|
367
|
-
<xsl:text>: </xsl:text>
|
368
|
-
<xsl:value-of select="mods:subTitle"/>
|
369
|
-
</xsl:if>
|
370
|
-
<xsl:if test="mods:partNumber">
|
371
|
-
|
372
|
-
<xsl:text>. </xsl:text>
|
373
|
-
<xsl:value-of select="mods:partNumber"/>
|
374
|
-
</xsl:if>
|
375
|
-
<xsl:if test="mods:partName">
|
376
|
-
<xsl:text>. </xsl:text>
|
377
|
-
<xsl:value-of select="mods:partName"/>
|
378
|
-
</xsl:if>
|
379
|
-
</xsl:template>
|
380
|
-
|
381
|
-
<xsl:template name="mods-name">
|
382
|
-
<xsl:variable name="name">
|
383
|
-
<xsl:for-each select="mods:namePart[not(@type)]">
|
384
|
-
<xsl:value-of select="."/>
|
385
|
-
|
386
|
-
<xsl:text> </xsl:text>
|
387
|
-
</xsl:for-each>
|
388
|
-
<xsl:value-of select="mods:namePart[@type='family']"/>
|
389
|
-
<xsl:if test="mods:namePart[@type='given']">
|
390
|
-
<xsl:text>, </xsl:text>
|
391
|
-
<xsl:value-of select="mods:namePart[@type='given']"/>
|
392
|
-
</xsl:if>
|
393
|
-
<xsl:if test="mods:namePart[@type='date']">
|
394
|
-
|
395
|
-
<xsl:text>, </xsl:text>
|
396
|
-
<xsl:value-of select="mods:namePart[@type='date']"/>
|
397
|
-
<xsl:text/>
|
398
|
-
</xsl:if>
|
399
|
-
<xsl:if test="mods:displayForm">
|
400
|
-
<xsl:text> (</xsl:text>
|
401
|
-
<xsl:value-of select="mods:displayForm"/>
|
402
|
-
|
403
|
-
<xsl:text>) </xsl:text>
|
404
|
-
</xsl:if>
|
405
|
-
<xsl:for-each select="mods:role[mods:roleTerm[@type='text']!='creator']">
|
406
|
-
<xsl:text> (</xsl:text>
|
407
|
-
<xsl:value-of select="normalize-space(.)"/>
|
408
|
-
<xsl:text>) </xsl:text>
|
409
|
-
</xsl:for-each>
|
410
|
-
|
411
|
-
</xsl:variable>
|
412
|
-
<xsl:value-of select="normalize-space($name)"/>
|
413
|
-
</xsl:template>
|
414
|
-
|
415
|
-
<!-- Index content metadata -->
|
416
|
-
<xsl:template match="contentMetadata">
|
417
|
-
<field name="content_type_facet">
|
418
|
-
<xsl:value-of select="@type"/>
|
419
|
-
</field>
|
420
|
-
<xsl:apply-templates select="./resource">
|
421
|
-
<xsl:sort data-type="number" select="@sequence"/>
|
422
|
-
</xsl:apply-templates>
|
423
|
-
</xsl:template>
|
424
|
-
<xsl:template match="contentMetadata/resource/file">
|
425
|
-
<field name="content_file_field">
|
426
|
-
<xsl:value-of select="@id"/>
|
427
|
-
</field>
|
428
|
-
<xsl:if test="@shelve = 'yes'">
|
429
|
-
<field name="shelved_content_file_field">
|
430
|
-
<xsl:value-of select="@id"/>
|
431
|
-
</field>
|
432
|
-
</xsl:if>
|
433
|
-
</xsl:template>
|
434
|
-
|
435
|
-
<!-- Index rights metadata -->
|
436
|
-
<xsl:template match="rightsMetadata">
|
437
|
-
<xsl:if test="access[@type='read']/machine/embargoReleaseDate">
|
438
|
-
<field name="embargo_status_facet">embargoed</field>
|
439
|
-
<field name="embargo_status_field">embargoed</field>
|
440
|
-
<field name="embargo_release_date">
|
441
|
-
<xsl:call-template name="long-enough-date">
|
442
|
-
<xsl:with-param name="date" select="access[@type='read']/machine/embargoReleaseDate/text()"/>
|
443
|
-
</xsl:call-template>
|
444
|
-
</field>
|
445
|
-
</xsl:if>
|
446
|
-
</xsl:template>
|
447
|
-
|
448
|
-
<!-- Index embargo metadata -->
|
449
|
-
<xsl:template match="embargoMetadata">
|
450
|
-
<xsl:if test="(status != '') and (releaseDate != '')">
|
451
|
-
<field name="embargo_status_facet">
|
452
|
-
<xsl:value-of select="status"/>
|
453
|
-
</field>
|
454
|
-
<field name="embargo_status_field">
|
455
|
-
<xsl:value-of select="status"/>
|
456
|
-
</field>
|
457
|
-
<field name="embargo_release_date">
|
458
|
-
<xsl:call-template name="long-enough-date">
|
459
|
-
<xsl:with-param name="date" select="releaseDate"/>
|
460
|
-
</xsl:call-template>
|
461
|
-
</field>
|
462
|
-
</xsl:if>
|
463
|
-
</xsl:template>
|
464
|
-
|
465
|
-
<!-- Workflows -->
|
466
|
-
<xsl:template name="lifecycle">
|
467
|
-
<xsl:variable name="lifecycle-uri" select="concat($workflow-stem, $PID, '/lifecycle')"/>
|
468
|
-
<xsl:message>Retrieving <xsl:value-of select="$lifecycle-uri"/></xsl:message>
|
469
|
-
<xsl:variable name="doc" select="document($lifecycle-uri)"/>
|
470
|
-
<xsl:apply-templates select="$doc/*"/>
|
471
|
-
</xsl:template>
|
472
|
-
|
473
|
-
<xsl:template match="lifecycle">
|
474
|
-
<xsl:for-each select="milestone">
|
475
|
-
<xsl:variable name="zdate" select="concat(substring(@date,1,19),'Z')"/>
|
476
|
-
<field name="lifecycle_field">
|
477
|
-
<xsl:value-of select="text()"/>:<xsl:value-of select="$zdate"/>
|
478
|
-
</field>
|
479
|
-
<field>
|
480
|
-
<xsl:attribute name="name">
|
481
|
-
<xsl:value-of select="concat(text(),'_date')"/>
|
482
|
-
</xsl:attribute>
|
483
|
-
<xsl:value-of select="$zdate"/>
|
484
|
-
</field>
|
485
|
-
<xsl:if test="position() = last()">
|
486
|
-
<field name="lifecycle_facet">
|
487
|
-
<xsl:value-of select="text()"/>
|
488
|
-
</field>
|
489
|
-
</xsl:if>
|
490
|
-
</xsl:for-each>
|
491
|
-
</xsl:template>
|
492
|
-
|
493
|
-
<xsl:template match="workflows">
|
494
|
-
<xsl:apply-templates select="./workflow"/>
|
495
|
-
</xsl:template>
|
496
|
-
|
497
|
-
<xsl:template match="workflow">
|
498
|
-
<xsl:param name="datastream-name" select="@id | ancestor::foxml:datastream/@ID"/>
|
499
|
-
<xsl:variable name="workflow-name" select="$datastream-name"/>
|
500
|
-
<xsl:variable name="workflow-token">
|
501
|
-
<xsl:call-template name="valid-field-name">
|
502
|
-
<xsl:with-param name="name" select="$workflow-name"/>
|
503
|
-
</xsl:call-template>
|
504
|
-
</xsl:variable>
|
505
|
-
<field name="wf_facet">
|
506
|
-
<xsl:value-of select="$workflow-name"/>
|
507
|
-
</field>
|
508
|
-
<field name="wf_wsp_facet">
|
509
|
-
<xsl:value-of select="$workflow-name"/>
|
510
|
-
</field>
|
511
|
-
<field name="wf_wps_facet">
|
512
|
-
<xsl:value-of select="$workflow-name"/>
|
513
|
-
</field>
|
514
|
-
<xsl:for-each select="process">
|
515
|
-
<xsl:sort select="@datetime" data-type="text"/>
|
516
|
-
<field name="wf_wsp_facet">
|
517
|
-
<xsl:value-of select="concat($workflow-name,':',@status)"/>
|
518
|
-
</field>
|
519
|
-
<field name="wf_wsp_facet">
|
520
|
-
<xsl:value-of select="concat($workflow-name,':',@status,':',@name)"/>
|
521
|
-
</field>
|
522
|
-
<field name="wf_wps_facet">
|
523
|
-
<xsl:value-of select="concat($workflow-name,':',@name)"/>
|
524
|
-
</field>
|
525
|
-
<field name="wf_wps_facet">
|
526
|
-
<xsl:value-of select="concat($workflow-name,':',@name,':',@status)"/>
|
527
|
-
</field>
|
528
|
-
<field name="wf_swp_facet">
|
529
|
-
<xsl:value-of select="@status"/>
|
530
|
-
</field>
|
531
|
-
<field name="wf_swp_facet">
|
532
|
-
<xsl:value-of select="concat(@status,':',$workflow-name)"/>
|
533
|
-
</field>
|
534
|
-
<field name="wf_swp_facet">
|
535
|
-
<xsl:value-of select="concat(@status,':',$workflow-name,':',@name)"/>
|
536
|
-
</field>
|
537
|
-
</xsl:for-each>
|
538
|
-
</xsl:template>
|
539
|
-
|
540
|
-
<!-- Admin Policy specific fields -->
|
541
|
-
<xsl:template match="administrativeMetadata">
|
542
|
-
<xsl:if test="./descMetadata/format">
|
543
|
-
<field name="apo_metadata_format_field">
|
544
|
-
<xsl:value-of select="./descMetadata/format/text()"/>
|
545
|
-
</field>
|
546
|
-
</xsl:if>
|
547
|
-
<xsl:if test="./descMetadata/format">
|
548
|
-
<field name="apo_metadata_source_field">
|
549
|
-
<xsl:value-of select="./descMetadata/source/text()"/>
|
550
|
-
</field>
|
551
|
-
</xsl:if>
|
552
|
-
<xsl:for-each select="registration/workflow">
|
553
|
-
<field name="apo_registration_workflow_field">
|
554
|
-
<xsl:value-of select="@id"/>
|
555
|
-
</field>
|
556
|
-
</xsl:for-each>
|
557
|
-
</xsl:template>
|
558
|
-
|
559
|
-
<xsl:template match="roleMetadata">
|
560
|
-
<xsl:for-each select="./role/*">
|
561
|
-
<xsl:variable name="role_value"><xsl:value-of select="identifier/@type"/>:<xsl:value-of
|
562
|
-
select="identifier/text()"/></xsl:variable>
|
563
|
-
<field name="apo_role_{local-name(.)}_{../@type}_field">
|
564
|
-
<xsl:value-of select="$role_value"/>
|
565
|
-
</field>
|
566
|
-
<field name="apo_role_{local-name(.)}_{../@type}_facet">
|
567
|
-
<xsl:value-of select="$role_value"/>
|
568
|
-
</field>
|
569
|
-
<xsl:if test="../@type = 'depositor' or ../@type = 'manager'">
|
570
|
-
<field name="apo_register_permissions_field">
|
571
|
-
<xsl:value-of select="$role_value"/>
|
572
|
-
</field>
|
573
|
-
<field name="apo_register_permissions_facet">
|
574
|
-
<xsl:value-of select="$role_value"/>
|
575
|
-
</field>
|
576
|
-
</xsl:if>
|
577
|
-
</xsl:for-each>
|
578
|
-
</xsl:template>
|
579
|
-
|
580
|
-
<!-- Utility Templates -->
|
581
|
-
<xsl:template match="text()|@*|processing-instruction()|comment()"/>
|
582
|
-
|
583
|
-
<xsl:template name="long-enough-date">
|
584
|
-
<xsl:param name="date"/>
|
585
|
-
<xsl:variable name="date-format" select="'0000-00-00T00:00:00Z'"/>
|
586
|
-
<xsl:choose>
|
587
|
-
<xsl:when test="string-length($date) < string-length($date-format)">
|
588
|
-
<xsl:value-of select="$date"/><xsl:value-of select="substring($date-format,string-length($date)+1)"/>
|
589
|
-
</xsl:when>
|
590
|
-
<xsl:otherwise>
|
591
|
-
<xsl:value-of select="$date"/>
|
592
|
-
</xsl:otherwise>
|
593
|
-
</xsl:choose>
|
594
|
-
</xsl:template>
|
595
|
-
|
596
|
-
<xsl:template name="valid-field-name">
|
597
|
-
<xsl:param name="name"/>
|
598
|
-
<xsl:value-of
|
599
|
-
select="translate($name,' ABCDEFGHIJKLMNOPQRSTUVWXYZ','_abcdefghijklmnopqrstuvwxyz')"/>
|
600
|
-
</xsl:template>
|
601
|
-
|
602
|
-
</xsl:stylesheet>
|
data/lib/gsearch/schema.xml
DELETED
@@ -1,229 +0,0 @@
|
|
1
|
-
<?xml version="1.0" ?>
|
2
|
-
<!--
|
3
|
-
Licensed to the Apache Software Foundation (ASF) under one or more
|
4
|
-
contributor license agreements. See the NOTICE file distributed with
|
5
|
-
this work for additional information regarding copyright ownership.
|
6
|
-
The ASF licenses this file to You under the Apache License, Version 2.0
|
7
|
-
(the "License"); you may not use this file except in compliance with
|
8
|
-
the License. You may obtain a copy of the License at
|
9
|
-
|
10
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
|
12
|
-
Unless required by applicable law or agreed to in writing, software
|
13
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
See the License for the specific language governing permissions and
|
16
|
-
limitations under the License.
|
17
|
-
-->
|
18
|
-
|
19
|
-
<!-- This is the Solr schema file. This file should be named "schema.xml" and
|
20
|
-
should be in the conf directory under the solr home
|
21
|
-
(i.e. ./solr/conf/schema.xml by default)
|
22
|
-
or located where the classloader for the Solr webapp can find it.
|
23
|
-
|
24
|
-
For more information, on how to customize this file, please see
|
25
|
-
http://wiki.apache.org/solr/SchemaXml
|
26
|
-
-->
|
27
|
-
|
28
|
-
<schema name="active_fedora" version="0.1">
|
29
|
-
<!-- attribute "name" is the name of this schema and is only used for display purposes.
|
30
|
-
Applications should change this to reflect the nature of the search collection.
|
31
|
-
version="1.1" is Solr's version number for the schema syntax and semantics. It should
|
32
|
-
not normally be changed by applications.
|
33
|
-
1.0: multiValued attribute did not exist, all fields are multiValued by nature
|
34
|
-
1.1: multiValued attribute introduced, false by default -->
|
35
|
-
|
36
|
-
<types>
|
37
|
-
<!-- field type definitions. The "name" attribute is
|
38
|
-
just a label to be used by field definitions. The "class"
|
39
|
-
attribute and any other attributes determine the real
|
40
|
-
behavior of the fieldtype.
|
41
|
-
Class names starting with "solr" refer to java classes in the
|
42
|
-
org.apache.solr.analysis package.
|
43
|
-
-->
|
44
|
-
|
45
|
-
<!-- The StrField type is not analyzed, but indexed/stored verbatim.
|
46
|
-
- StrField and TextField support an optional compressThreshold which
|
47
|
-
limits compression (if enabled in the derived fields) to values which
|
48
|
-
exceed a certain size (in characters).
|
49
|
-
-->
|
50
|
-
<fieldtype name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
|
51
|
-
|
52
|
-
<!-- boolean type: "true" or "false" -->
|
53
|
-
<fieldtype name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true"/>
|
54
|
-
|
55
|
-
<!-- The optional sortMissingLast and sortMissingFirst attributes are
|
56
|
-
currently supported on types that are sorted internally as strings.
|
57
|
-
- If sortMissingLast="true", then a sort on this field will cause documents
|
58
|
-
without the field to come after documents with the field,
|
59
|
-
regardless of the requested sort order (asc or desc).
|
60
|
-
- If sortMissingFirst="true", then a sort on this field will cause documents
|
61
|
-
without the field to come before documents with the field,
|
62
|
-
regardless of the requested sort order.
|
63
|
-
- If sortMissingLast="false" and sortMissingFirst="false" (the default),
|
64
|
-
then default lucene sorting will be used which places docs without the
|
65
|
-
field first in an ascending sort and last in a descending sort.
|
66
|
-
-->
|
67
|
-
|
68
|
-
|
69
|
-
<!-- numeric field types that store and index the text
|
70
|
-
value verbatim (and hence don't support range queries, since the
|
71
|
-
lexicographic ordering isn't equal to the numeric ordering) -->
|
72
|
-
<fieldtype name="integer" class="solr.IntField" omitNorms="true"/>
|
73
|
-
<fieldtype name="long" class="solr.LongField" omitNorms="true"/>
|
74
|
-
<fieldtype name="float" class="solr.FloatField" omitNorms="true"/>
|
75
|
-
<fieldtype name="double" class="solr.DoubleField" omitNorms="true"/>
|
76
|
-
|
77
|
-
|
78
|
-
<!-- Numeric field types that manipulate the value into
|
79
|
-
a string value that isn't human-readable in its internal form,
|
80
|
-
but with a lexicographic ordering the same as the numeric ordering,
|
81
|
-
so that range queries work correctly. -->
|
82
|
-
<fieldtype name="sint" class="solr.SortableIntField" sortMissingLast="true" omitNorms="true"/>
|
83
|
-
<fieldtype name="slong" class="solr.SortableLongField" sortMissingLast="true" omitNorms="true"/>
|
84
|
-
<fieldtype name="sfloat" class="solr.SortableFloatField" sortMissingLast="true" omitNorms="true"/>
|
85
|
-
<fieldtype name="sdouble" class="solr.SortableDoubleField" sortMissingLast="true" omitNorms="true"/>
|
86
|
-
|
87
|
-
|
88
|
-
<!-- The format for this date field is of the form 1995-12-31T23:59:59Z, and
|
89
|
-
is a more restricted form of the canonical representation of dateTime
|
90
|
-
http://www.w3.org/TR/xmlschema-2/#dateTime
|
91
|
-
The trailing "Z" designates UTC time and is mandatory.
|
92
|
-
Optional fractional seconds are allowed: 1995-12-31T23:59:59.999Z
|
93
|
-
All other components are mandatory.
|
94
|
-
|
95
|
-
Expressions can also be used to denote calculations that should be
|
96
|
-
performed relative to "NOW" to determine the value, ie...
|
97
|
-
|
98
|
-
NOW/HOUR
|
99
|
-
... Round to the start of the current hour
|
100
|
-
NOW-1DAY
|
101
|
-
... Exactly 1 day prior to now
|
102
|
-
NOW/DAY+6MONTHS+3DAYS
|
103
|
-
... 6 months and 3 days in the future from the start of
|
104
|
-
the current day
|
105
|
-
|
106
|
-
Consult the DateField javadocs for more information.
|
107
|
-
-->
|
108
|
-
<fieldtype name="date" class="solr.DateField" sortMissingLast="true" omitNorms="true"/>
|
109
|
-
|
110
|
-
<!-- solr.TextField allows the specification of custom text analyzers
|
111
|
-
specified as a tokenizer and a list of token filters. Different
|
112
|
-
analyzers may be specified for indexing and querying.
|
113
|
-
|
114
|
-
The optional positionIncrementGap puts space between multiple fields of
|
115
|
-
this type on the same document, with the purpose of preventing false phrase
|
116
|
-
matching across fields.
|
117
|
-
|
118
|
-
For more info on customizing your analyzer chain, please see
|
119
|
-
http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters
|
120
|
-
-->
|
121
|
-
|
122
|
-
<!-- One can also specify an existing Analyzer class that has a
|
123
|
-
default constructor via the class attribute on the analyzer element
|
124
|
-
<fieldtype name="text_greek" class="solr.TextField">
|
125
|
-
<analyzer class="org.apache.lucene.analysis.el.GreekAnalyzer"/>
|
126
|
-
</fieldType>
|
127
|
-
-->
|
128
|
-
|
129
|
-
<!-- A text field that only splits on whitespace for exact matching of words -->
|
130
|
-
<fieldtype name="text_ws" class="solr.TextField" positionIncrementGap="100">
|
131
|
-
<analyzer>
|
132
|
-
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
|
133
|
-
</analyzer>
|
134
|
-
</fieldtype>
|
135
|
-
|
136
|
-
<fieldtype name="text" class="solr.TextField" positionIncrementGap="100">
|
137
|
-
<analyzer>
|
138
|
-
<tokenizer class="solr.StandardTokenizerFactory"/>
|
139
|
-
<filter class="solr.StandardFilterFactory"/>
|
140
|
-
<filter class="solr.LowerCaseFilterFactory"/>
|
141
|
-
</analyzer>
|
142
|
-
</fieldtype>
|
143
|
-
|
144
|
-
<fieldtype name="text_zh" class="solr.TextField">
|
145
|
-
<analyzer class="org.apache.lucene.analysis.cn.ChineseAnalyzer"/>
|
146
|
-
</fieldtype>
|
147
|
-
|
148
|
-
|
149
|
-
<!-- Less flexible matching, but less false matches. Probably not ideal for product names,
|
150
|
-
but may be good for SKUs. Can insert dashes in the wrong place and still match. -->
|
151
|
-
<fieldtype name="textTight" class="solr.TextField" positionIncrementGap="100" >
|
152
|
-
<analyzer>
|
153
|
-
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
|
154
|
-
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="false"/>
|
155
|
-
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
|
156
|
-
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
|
157
|
-
<filter class="solr.LowerCaseFilterFactory"/>
|
158
|
-
<filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
|
159
|
-
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
|
160
|
-
</analyzer>
|
161
|
-
</fieldtype>
|
162
|
-
|
163
|
-
</types>
|
164
|
-
|
165
|
-
|
166
|
-
<fields>
|
167
|
-
<!-- Valid attributes for fields:
|
168
|
-
name: mandatory - the name for the field
|
169
|
-
type: mandatory - the name of a previously defined type from the <types> section
|
170
|
-
indexed: true if this field should be indexed (searchable or sortable)
|
171
|
-
stored: true if this field should be retrievable
|
172
|
-
compressed: [false] if this field should be stored using gzip compression
|
173
|
-
(this will only apply if the field type is compressable; among
|
174
|
-
the standard field types, only TextField and StrField are)
|
175
|
-
multiValued: true if this field may contain multiple values per document
|
176
|
-
omitNorms: (expert) set to true to omit the norms associated with
|
177
|
-
this field (this disables length normalization and index-time
|
178
|
-
boosting for the field, and saves some memory). Only full-text
|
179
|
-
fields or fields that need an index-time boost need norms.
|
180
|
-
-->
|
181
|
-
|
182
|
-
<field name="PID" type="string" indexed="true" stored="true"/>
|
183
|
-
|
184
|
-
<!-- catchall field, containing all other searchable text fields (implemented
|
185
|
-
via copyField further on in this schema -->
|
186
|
-
<field name="text" type="text" indexed="true" stored="false" multiValued="true"/>
|
187
|
-
<!-- catchall field, containing all other searchable text fields (implemented
|
188
|
-
via copyField further on in this schema -->
|
189
|
-
<field name="date" type="date" indexed="true" stored="false" multiValued="true"/>
|
190
|
-
|
191
|
-
<!-- Dynamic field definitions. If a field name is not found, dynamicFields
|
192
|
-
will be used if the name matches any of the patterns.
|
193
|
-
RESTRICTION: the glob-like pattern in the name attribute must have
|
194
|
-
a "*" only at the start or the end.
|
195
|
-
EXAMPLE: name="*_i" will match any field ending in _i (like myid_i, z_i)
|
196
|
-
Longer patterns will be matched first. if equal size patterns
|
197
|
-
both match, the first appearing in the schema will be used. -->
|
198
|
-
<dynamicField name="*_date" type="date" indexed="true" stored="true" multiValued="true"/>
|
199
|
-
<dynamicField name="*_name" type="date" indexed="true" stored="true" multiValued="true"/>
|
200
|
-
<dynamicField name="*_field" type="text" indexed="true" stored="true" multiValued="true"/>
|
201
|
-
|
202
|
-
<dynamicField name="*_facet" type="string" indexed="true" stored="true" multiValued="true"/>
|
203
|
-
<dynamicField name="*_zh_text" type="text_zh" indexed="true" stored="true" multiValued="true"/>
|
204
|
-
<dynamicField name="*_text" type="text" indexed="true" stored="true" multiValued="true"/>
|
205
|
-
<dynamicField name="*_display" type="text" indexed="false" stored="true" multiValued="true"/>
|
206
|
-
</fields>
|
207
|
-
|
208
|
-
<!-- field to use to determine and enforce document uniqueness. -->
|
209
|
-
<uniqueKey>PID</uniqueKey>
|
210
|
-
|
211
|
-
<!-- field for the QueryParser to use when an explicit fieldname is absent -->
|
212
|
-
<defaultSearchField>text</defaultSearchField>
|
213
|
-
|
214
|
-
<!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
|
215
|
-
<solrQueryParser defaultOperator="AND"/>
|
216
|
-
|
217
|
-
<!-- copyField commands copy one field to another at the time a document
|
218
|
-
is added to the index. It's used either to index the same field differently,
|
219
|
-
or to add multiple fields to the same field for easier/faster searching. -->
|
220
|
-
<copyField source="*_date" dest="date"/>
|
221
|
-
<copyField source="*_text" dest="text"/>
|
222
|
-
<copyField source="*_facet" dest="text"/>
|
223
|
-
|
224
|
-
<!-- Similarity is the scoring routine for each document vs. a query.
|
225
|
-
A custom similarity may be specified here, but the default is fine
|
226
|
-
for most applications. -->
|
227
|
-
<!-- <similarity class="org.apache.lucene.search.DefaultSimilarity"/> -->
|
228
|
-
|
229
|
-
</schema>
|