search_solr_tools 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +88 -0
  3. data/COPYING +674 -0
  4. data/README.md +203 -0
  5. data/bin/search_solr_tools +87 -0
  6. data/lib/search_solr_tools.rb +8 -0
  7. data/lib/search_solr_tools/config/environments.rb +12 -0
  8. data/lib/search_solr_tools/config/environments.yaml +73 -0
  9. data/lib/search_solr_tools/harvesters/ade_auto_suggest.rb +43 -0
  10. data/lib/search_solr_tools/harvesters/auto_suggest.rb +61 -0
  11. data/lib/search_solr_tools/harvesters/base.rb +183 -0
  12. data/lib/search_solr_tools/harvesters/bcodmo.rb +55 -0
  13. data/lib/search_solr_tools/harvesters/cisl.rb +63 -0
  14. data/lib/search_solr_tools/harvesters/echo.rb +50 -0
  15. data/lib/search_solr_tools/harvesters/eol.rb +53 -0
  16. data/lib/search_solr_tools/harvesters/ices.rb +55 -0
  17. data/lib/search_solr_tools/harvesters/nmi.rb +32 -0
  18. data/lib/search_solr_tools/harvesters/nodc.rb +72 -0
  19. data/lib/search_solr_tools/harvesters/nsidc_auto_suggest.rb +33 -0
  20. data/lib/search_solr_tools/harvesters/nsidc_json.rb +60 -0
  21. data/lib/search_solr_tools/harvesters/oai.rb +59 -0
  22. data/lib/search_solr_tools/harvesters/pdc.rb +38 -0
  23. data/lib/search_solr_tools/harvesters/rda.rb +33 -0
  24. data/lib/search_solr_tools/harvesters/tdar.rb +57 -0
  25. data/lib/search_solr_tools/harvesters/usgs.rb +74 -0
  26. data/lib/search_solr_tools/helpers/bounding_box_util.rb +37 -0
  27. data/lib/search_solr_tools/helpers/csw_iso_query_builder.rb +30 -0
  28. data/lib/search_solr_tools/helpers/facet_configuration.rb +19 -0
  29. data/lib/search_solr_tools/helpers/iso_namespaces.rb +30 -0
  30. data/lib/search_solr_tools/helpers/iso_to_solr.rb +96 -0
  31. data/lib/search_solr_tools/helpers/iso_to_solr_format.rb +198 -0
  32. data/lib/search_solr_tools/helpers/query_builder.rb +13 -0
  33. data/lib/search_solr_tools/helpers/selectors.rb +20 -0
  34. data/lib/search_solr_tools/helpers/solr_format.rb +260 -0
  35. data/lib/search_solr_tools/helpers/tdar_format.rb +70 -0
  36. data/lib/search_solr_tools/helpers/translate_spatial_coverage.rb +77 -0
  37. data/lib/search_solr_tools/helpers/translate_temporal_coverage.rb +40 -0
  38. data/lib/search_solr_tools/helpers/usgs_format.rb +50 -0
  39. data/lib/search_solr_tools/selectors/cisl.rb +112 -0
  40. data/lib/search_solr_tools/selectors/echo_iso.rb +111 -0
  41. data/lib/search_solr_tools/selectors/ices_iso.rb +107 -0
  42. data/lib/search_solr_tools/selectors/nmi.rb +106 -0
  43. data/lib/search_solr_tools/selectors/nodc_iso.rb +107 -0
  44. data/lib/search_solr_tools/selectors/pdc_iso.rb +108 -0
  45. data/lib/search_solr_tools/selectors/rda.rb +106 -0
  46. data/lib/search_solr_tools/selectors/tdar_opensearch.rb +89 -0
  47. data/lib/search_solr_tools/selectors/usgs_iso.rb +105 -0
  48. data/lib/search_solr_tools/translators/bcodmo_json.rb +69 -0
  49. data/lib/search_solr_tools/translators/eol_to_solr.rb +78 -0
  50. data/lib/search_solr_tools/translators/nsidc_json.rb +190 -0
  51. data/lib/search_solr_tools/version.rb +3 -0
  52. data/search_solr_tools.gemspec +45 -0
  53. metadata +345 -0
@@ -0,0 +1,50 @@
1
+ require_relative './iso_namespaces'
2
+ require_relative './iso_to_solr_format'
3
+
4
+ module SearchSolrTools
5
+ module Helpers
6
+ # Special formatter for dealing with temporal metadata issues in the USGS feed
7
+ class UsgsFormat < IsoToSolrFormat
8
+ TEMPORAL_INDEX_STRING = proc { |node| UsgsFormat.temporal_index_str(node) }
9
+ TEMPORAL_DISPLAY_STRING = proc { |node| UsgsFormat.temporal_display_str(node) }
10
+ TEMPORAL_DURATION = proc { |node| UsgsFormat.get_temporal_duration(node) }
11
+ FACET_TEMPORAL_DURATION = proc { |node| UsgsFormat.get_temporal_duration_facet(node) }
12
+
13
+ # for USGS, a single date entry (i.e., missing either start or end date, and
14
+ # the value that is present is not clearly labeled) means the whole year if
15
+ # just a year is given, or just a single day if just a single day is given
16
+ def self.date_range(temporal_node, formatted = false)
17
+ xpath = './/gco:Date'
18
+ namespaces = IsoNamespaces.namespaces(temporal_node)
19
+
20
+ temporal_node_count = temporal_node.xpath(xpath, namespaces).size
21
+ date_str = temporal_node.at_xpath(xpath, namespaces).text
22
+
23
+ super if temporal_node_count != 1
24
+
25
+ case date_str
26
+ when /^[0-9]{4}$/
27
+ year_to_range(date_str)
28
+ when /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/
29
+ single_date_to_range(date_str)
30
+ else
31
+ super
32
+ end
33
+ end
34
+
35
+ def self.single_date_to_range(date)
36
+ {
37
+ start: date,
38
+ end: date
39
+ }
40
+ end
41
+
42
+ def self.year_to_range(year)
43
+ {
44
+ start: "#{year}-01-01",
45
+ end: "#{year}-12-31"
46
+ }
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,112 @@
1
+ require 'search_solr_tools'
2
+
3
+ module SearchSolrTools
4
+ module Selectors
5
+ # The hash contains keys that should map to the fields in the solr schema,
6
+ # the keys are called selectors and are in charge of selecting the nodes
7
+ # from the ISO document, applying the default value if none of the xpaths
8
+ # resolved to a value and formatting the field. xpaths and multivalue are
9
+ # required, default_value, format, and reduce are optional.
10
+ #
11
+ # reduce takes the formatted result of multiple nodes and produces a single
12
+ # result. This is for fields that are not multivalued, but their value
13
+ # should consider information from all the nodes (for example, storing
14
+ # only the maximum duration from multiple temporal coverage fields, taking
15
+ # the sum of multiple spatial areas)
16
+ CISL = {
17
+ authoritative_id: {
18
+ xpaths: ['.//oai:header/oai:identifier'],
19
+ multivalue: false
20
+ },
21
+ title: {
22
+ xpaths: ['.//dif:Entry_Title'],
23
+ multivalue: false
24
+ },
25
+ summary: {
26
+ xpaths: ['.//dif:Summary/dif:Abstract'],
27
+ multivalue: false
28
+ },
29
+ data_centers: {
30
+ xpaths: [''],
31
+ default_values: [SearchSolrTools::Helpers::SolrFormat::DATA_CENTER_NAMES[:CISL][:long_name]],
32
+ multivalue: false
33
+ },
34
+ authors: {
35
+ xpaths: [''],
36
+ multivalue: true
37
+ },
38
+ keywords: {
39
+ xpaths: [
40
+ './/dif:Parameters/dif:Category',
41
+ './/dif:Parameters/dif:Topic',
42
+ './/dif:Parameters/dif:Term',
43
+ './/dif:Parameters/dif:Variable_Level_1'
44
+ ].reverse,
45
+ multivalue: true
46
+ },
47
+ last_revision_date: {
48
+ xpaths: ['.//dif:Last_DIF_Revision_Date'],
49
+ default_values: [SearchSolrTools::Helpers::SolrFormat.date_str(DateTime.now)], # formats the date into ISO8601 as in http://lucene.apache.org/solr/4_4_0/solr-core/org/apache/solr/schema/DateField.html
50
+ multivalue: false,
51
+ format: SearchSolrTools::Helpers::SolrFormat::DATE
52
+ },
53
+ dataset_url: {
54
+ xpaths: ['.//dif:Related_URL/dif:URL'],
55
+ multivalue: false
56
+ },
57
+ spatial_coverages: {
58
+ xpaths: ['.//dif:Spatial_Coverage'],
59
+ multivalue: true,
60
+ format: SearchSolrTools::Helpers::IsoToSolrFormat::SPATIAL_DISPLAY
61
+ },
62
+ spatial: {
63
+ xpaths: ['.//dif:Spatial_Coverage'],
64
+ multivalue: true,
65
+ format: SearchSolrTools::Helpers::IsoToSolrFormat::SPATIAL_INDEX
66
+ },
67
+ spatial_area: {
68
+ xpaths: ['.//dif:Spatial_Coverage'],
69
+ multivalue: false,
70
+ reduce: SearchSolrTools::Helpers::IsoToSolrFormat::MAX_SPATIAL_AREA,
71
+ format: SearchSolrTools::Helpers::IsoToSolrFormat::SPATIAL_AREA
72
+ },
73
+ temporal: {
74
+ xpaths: ['.//dif:Temporal_Coverage'],
75
+ multivalue: true,
76
+ format: SearchSolrTools::Helpers::IsoToSolrFormat::TEMPORAL_INDEX_STRING
77
+ },
78
+ temporal_coverages: {
79
+ xpaths: ['.//dif:Temporal_Coverage'],
80
+ multivalue: true,
81
+ format: SearchSolrTools::Helpers::IsoToSolrFormat::TEMPORAL_DISPLAY_STRING
82
+ },
83
+ temporal_duration: {
84
+ xpaths: ['.//dif:Temporal_Coverage'],
85
+ multivalue: false,
86
+ reduce: SearchSolrTools::Helpers::SolrFormat::REDUCE_TEMPORAL_DURATION,
87
+ format: SearchSolrTools::Helpers::IsoToSolrFormat::TEMPORAL_DURATION
88
+ },
89
+ source: {
90
+ xpaths: [''],
91
+ default_values: ['ADE'],
92
+ multivalue: false
93
+ },
94
+ facet_data_center: {
95
+ xpaths: [''],
96
+ default_values: ["#{SearchSolrTools::Helpers::SolrFormat::DATA_CENTER_NAMES[:CISL][:long_name]} | #{Helpers::SolrFormat::DATA_CENTER_NAMES[:CISL][:short_name]}"],
97
+ multivalue: false
98
+ },
99
+ facet_spatial_scope: {
100
+ xpaths: ['.//dif:Spatial_Coverage'],
101
+ multivalue: true,
102
+ format: SearchSolrTools::Helpers::IsoToSolrFormat::FACET_SPATIAL_SCOPE
103
+ },
104
+ facet_temporal_duration: {
105
+ xpaths: ['.//dif:Temporal_Coverage'],
106
+ default_values: [SearchSolrTools::Helpers::SolrFormat::NOT_SPECIFIED],
107
+ format: SearchSolrTools::Helpers::IsoToSolrFormat::FACET_TEMPORAL_DURATION,
108
+ multivalue: true
109
+ }
110
+ }
111
+ end
112
+ end
@@ -0,0 +1,111 @@
1
+ require 'search_solr_tools'
2
+
3
+ module SearchSolrTools
4
+ module Selectors
5
+ # The hash contains keys that should map to the fields in the solr schema,
6
+ # the keys are called selectors and are in charge of selecting the nodes
7
+ # from the ISO document, applying the default value if none of the xpaths
8
+ # resolved to a value and formatting the field. xpaths and multivalue are
9
+ # required, default_value and format are optional
10
+ ECHO = {
11
+ authoritative_id: {
12
+ xpaths: ['.//@echo_dataset_id'],
13
+ multivalue: false
14
+ },
15
+ title: {
16
+ xpaths: ['.//Collection/LongName'],
17
+ multivalue: false
18
+ },
19
+ summary: {
20
+ xpaths: ['.//Collection/Description'],
21
+ multivalue: false
22
+ },
23
+ data_centers: {
24
+ xpaths: [''],
25
+ default_values: [Helpers::SolrFormat::DATA_CENTER_NAMES[:ECHO][:long_name]],
26
+ multivalue: false
27
+ },
28
+ authors: {
29
+ xpaths: [''],
30
+ multivalue: true
31
+ },
32
+ keywords: {
33
+ xpaths: ['.//Collection/ScienceKeywords/ScienceKeyword'],
34
+ multivalue: true,
35
+ format: Helpers::IsoToSolrFormat::KEYWORDS
36
+ },
37
+ last_revision_date: {
38
+ xpaths: ['.//Collection/LastUpdate'],
39
+ default_values: [Helpers::SolrFormat.date_str(DateTime.now)], # formats the date into ISO8601 as in http://lucene.apache.org/solr/4_4_0/solr-core/org/apache/solr/schema/DateField.html
40
+ multivalue: false,
41
+ format: Helpers::SolrFormat::DATE
42
+ },
43
+ dataset_url: {
44
+ xpaths: ['.//Collection/OnlineResources/OnlineResource[contains(./Type/text(),"static URL")]/URL',
45
+ './/Collection/OnlineResources/OnlineResource[contains(./Type/text(), "VIEW RELATED INFORMATION")]/URL',
46
+ './/Collection/OnlineAccessURLs/OnlineAccessURL/[contains(./URLDescription/text(), "Data Access")]/URL',
47
+ './/Collection/OnlineResources/OnlineResource[contains(./Type/text(),"Guide Document for this product at NSIDC")]/URL',
48
+ './/Collection/OnlineResources/OnlineResource[contains(./Type/text(),"DOI URL")]/URL',
49
+ './/Collection/OnlineResources/OnlineResource[contains(./Type/text(),"ECSCollGuide")]/URL',
50
+ './/Collection/OnlineResources/OnlineResource[contains(./Type/text(),"GET DATA : ON-LINE ARCHIVE")]/URL',
51
+ './/Collection/OnlineResources/OnlineResource/URL',
52
+ './/Collection/OnlineAccessURLs/OnlineAccessURL/URL'],
53
+ default_values: ['https://earthdata.nasa.gov/echo'],
54
+ multivalue: false
55
+ },
56
+ spatial_coverages: {
57
+ xpaths: ['.//Collection/Spatial/HorizontalSpatialDomain/Geometry/BoundingRectangle'],
58
+ multivalue: true,
59
+ format: Helpers::IsoToSolrFormat::SPATIAL_DISPLAY
60
+ },
61
+ spatial: {
62
+ xpaths: ['.//Collection/Spatial/HorizontalSpatialDomain/Geometry/BoundingRectangle'],
63
+ multivalue: true,
64
+ format: Helpers::IsoToSolrFormat::SPATIAL_INDEX
65
+ },
66
+ spatial_area: {
67
+ xpaths: ['.//Collection/Spatial/HorizontalSpatialDomain/Geometry/BoundingRectangle'],
68
+ multivalue: false,
69
+ reduce: Helpers::IsoToSolrFormat::MAX_SPATIAL_AREA,
70
+ format: Helpers::IsoToSolrFormat::SPATIAL_AREA
71
+ },
72
+ temporal_coverages: {
73
+ xpaths: ['.//Collection/Temporal/RangeDateTime'],
74
+ multivalue: true,
75
+ format: Helpers::IsoToSolrFormat::TEMPORAL_DISPLAY_STRING_FORMATTED
76
+ },
77
+ temporal_duration: {
78
+ xpaths: ['.//Collection/Temporal/RangeDateTime'],
79
+ multivalue: false,
80
+ reduce: Helpers::SolrFormat::REDUCE_TEMPORAL_DURATION,
81
+ format: Helpers::IsoToSolrFormat::TEMPORAL_DURATION
82
+ },
83
+ temporal: {
84
+ xpaths: ['.//Collection/Temporal/RangeDateTime'],
85
+ multivalue: true,
86
+ format: Helpers::IsoToSolrFormat::TEMPORAL_INDEX_STRING
87
+ },
88
+ source: {
89
+ xpaths: [''],
90
+ default_values: ['ADE'],
91
+ multivalue: false
92
+ },
93
+ facet_data_center: {
94
+ xpaths: [''],
95
+ default_values: ["#{Helpers::SolrFormat::DATA_CENTER_NAMES[:ECHO][:long_name]} | #{Helpers::SolrFormat::DATA_CENTER_NAMES[:ECHO][:short_name]}"],
96
+ multivalue: false
97
+ },
98
+ facet_spatial_scope: {
99
+ xpaths: ['.//Collection/Spatial/HorizontalSpatialDomain/Geometry/BoundingRectangle'],
100
+ multivalue: true,
101
+ format: Helpers::IsoToSolrFormat::FACET_SPATIAL_SCOPE
102
+ },
103
+ facet_temporal_duration: {
104
+ xpaths: ['.//Collection/Temporal/RangeDateTime'],
105
+ default_values: [Helpers::SolrFormat::NOT_SPECIFIED],
106
+ format: Helpers::IsoToSolrFormat::FACET_TEMPORAL_DURATION,
107
+ multivalue: true
108
+ }
109
+ }
110
+ end
111
+ end
@@ -0,0 +1,107 @@
1
+ require 'search_solr_tools'
2
+
3
+ module SearchSolrTools
4
+ module Selectors
5
+ # The hash contains keys that should map to the fields in the solr schema,
6
+ # the keys are called selectors and are in charge of selecting the nodes
7
+ # from the ISO document, applying the default value if none of the xpaths
8
+ # resolved to a value and formatting the field. xpaths and multivalue are
9
+ # required, default_value and format are optional
10
+ ICES = {
11
+ authoritative_id: {
12
+ xpaths: ['.//gmd:fileIdentifier/gco:CharacterString'],
13
+ multivalue: false
14
+ },
15
+ title: {
16
+ xpaths: ['.//gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:title/gco:CharacterString'],
17
+ multivalue: false
18
+ },
19
+ summary: {
20
+ xpaths: ['.//gmd:identificationInfo/gmd:MD_DataIdentification/gmd:abstract/gco:CharacterString'],
21
+ multivalue: false
22
+ },
23
+ data_centers: {
24
+ xpaths: [''],
25
+ default_values: [Helpers::SolrFormat::DATA_CENTER_NAMES[:ICES][:long_name]],
26
+ multivalue: false
27
+ },
28
+ authors: {
29
+ xpaths: [".//gmd:CI_ResponsibleParty[./gmd:role/gmd:CI_RoleCode[@codeListValue='principalInvestigator']]/gmd:individualName/gco:CharacterString"],
30
+ multivalue: true
31
+ },
32
+ keywords: {
33
+ xpaths: ['.//gmd:descriptiveKeywords/gmd:MD_Keywords/gmd:keyword/gco:CharacterString',
34
+ './/gmd:descriptiveKeywords/gmd:MD_Keywords/gmd:keyword/gmx:Anchor'],
35
+ multivalue: true
36
+ },
37
+ last_revision_date: {
38
+ xpaths: ['.//gmd:dateStamp/gco:Date', './/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:date/gmd:CI_Date/gmd:date/gco:DateTime'],
39
+ default_values: [Helpers::SolrFormat.date_str(DateTime.now)], # formats the date into ISO8601 as in http://lucene.apache.org/solr/4_4_0/solr-core/org/apache/solr/schema/DateField.html
40
+ multivalue: false,
41
+ format: Helpers::SolrFormat::DATE
42
+ },
43
+ dataset_url: {
44
+ xpaths: ['.//gmd:fileIdentifier/gco:CharacterString'],
45
+ multivalue: false,
46
+ format: Helpers::IsoToSolrFormat:: ICES_DATASET_URL
47
+ },
48
+ spatial_coverages: {
49
+ xpaths: ['.//gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox'],
50
+ multivalue: true,
51
+ format: Helpers::IsoToSolrFormat::SPATIAL_DISPLAY
52
+ },
53
+ spatial: {
54
+ xpaths: ['.//gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox'],
55
+ multivalue: true,
56
+ format: Helpers::IsoToSolrFormat::SPATIAL_INDEX
57
+ },
58
+ spatial_area: {
59
+ xpaths: ['.//gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox'],
60
+ multivalue: false,
61
+ reduce: Helpers::IsoToSolrFormat::MAX_SPATIAL_AREA,
62
+ format: Helpers::IsoToSolrFormat::SPATIAL_AREA
63
+ },
64
+ temporal_coverages: {
65
+ xpaths: ['.//gmd:EX_TemporalExtent'],
66
+ multivalue: false,
67
+ format: Helpers::IsoToSolrFormat::TEMPORAL_DISPLAY_STRING_FORMATTED
68
+ },
69
+ temporal_duration: {
70
+ xpaths: ['.//gmd:EX_TemporalExtent'],
71
+ multivalue: false,
72
+ reduce: Helpers::SolrFormat::REDUCE_TEMPORAL_DURATION,
73
+ format: Helpers::IsoToSolrFormat::TEMPORAL_DURATION
74
+ },
75
+ temporal: {
76
+ xpaths: ['.//gmd:EX_TemporalExtent'],
77
+ multivalue: true,
78
+ format: Helpers::IsoToSolrFormat::TEMPORAL_INDEX_STRING
79
+ },
80
+ sensors: {
81
+ xpaths: ['.//gmi:acquisitionInformation/gmi:MI_AcquisitionInformation/gmi:instrument/gmi:MI_Instrument/gmi:citation/gmd:CI_Citation/gmd:title/gco:CharacterString'],
82
+ multivalue: true
83
+ },
84
+ source: {
85
+ xpaths: [''],
86
+ default_values: ['ADE'],
87
+ multivalue: false
88
+ },
89
+ facet_data_center: {
90
+ xpaths: [''],
91
+ default_values: ["#{Helpers::SolrFormat::DATA_CENTER_NAMES[:ICES][:long_name]} | #{Helpers::SolrFormat::DATA_CENTER_NAMES[:ICES][:short_name]}"],
92
+ multivalue: false
93
+ },
94
+ facet_spatial_scope: {
95
+ xpaths: ['.//gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox'],
96
+ multivalue: true,
97
+ format: Helpers::IsoToSolrFormat::FACET_SPATIAL_SCOPE
98
+ },
99
+ facet_temporal_duration: {
100
+ xpaths: ['.//gmd:EX_TemporalExtent'],
101
+ default_values: [Helpers::SolrFormat::NOT_SPECIFIED],
102
+ format: Helpers::IsoToSolrFormat::FACET_TEMPORAL_DURATION,
103
+ multivalue: true
104
+ }
105
+ }
106
+ end
107
+ end
@@ -0,0 +1,106 @@
1
+ require 'search_solr_tools'
2
+
3
+ module SearchSolrTools
4
+ module Selectors
5
+ # The hash contains keys that should map to the fields in the solr schema,
6
+ # the keys are called selectors and are in charge of selecting the nodes
7
+ # from the ISO document, applying the default value if none of the xpaths
8
+ # resolved to a value and formatting the field. xpaths and multivalue are
9
+ # required, default_value and format are optional.
10
+ NMI = {
11
+ authoritative_id: {
12
+ xpaths: ['.//oai:header/oai:identifier'],
13
+ multivalue: false
14
+ },
15
+ title: {
16
+ xpaths: ['.//dif:Entry_Title'],
17
+ multivalue: false
18
+ },
19
+ summary: {
20
+ xpaths: ['.//dif:Summary'],
21
+ multivalue: false
22
+ },
23
+ data_centers: {
24
+ xpaths: [''],
25
+ default_values: [Helpers::SolrFormat::DATA_CENTER_NAMES[:NMI][:long_name]],
26
+ multivalue: false
27
+ },
28
+ authors: {
29
+ xpaths: [''],
30
+ multivalue: true
31
+ },
32
+ keywords: {
33
+ xpaths: [
34
+ './/dif:Parameters/dif:Category',
35
+ './/dif:Parameters/dif:Topic',
36
+ './/dif:Parameters/dif:Term',
37
+ './/dif:Parameters/dif:Variable_Level_1'
38
+ ].reverse,
39
+ multivalue: true
40
+ },
41
+ last_revision_date: {
42
+ xpaths: ['.//dif:Last_DIF_Revision_Date'],
43
+ default_values: [Helpers::SolrFormat.date_str(DateTime.now)], # formats the date into ISO8601 as in http://lucene.apache.org/solr/4_4_0/solr-core/org/apache/solr/schema/DateField.html
44
+ multivalue: false,
45
+ format: Helpers::SolrFormat::DATE
46
+ },
47
+ dataset_url: {
48
+ xpaths: ['.//dif:Related_URL/dif:URL'],
49
+ multivalue: false
50
+ },
51
+ spatial_coverages: {
52
+ xpaths: ['.//dif:Spatial_Coverage'],
53
+ multivalue: true,
54
+ format: Helpers::IsoToSolrFormat::SPATIAL_DISPLAY
55
+ },
56
+ spatial: {
57
+ xpaths: ['.//dif:Spatial_Coverage'],
58
+ multivalue: true,
59
+ format: Helpers::IsoToSolrFormat::SPATIAL_INDEX
60
+ },
61
+ spatial_area: {
62
+ xpaths: ['.//dif:Spatial_Coverage'],
63
+ multivalue: false,
64
+ reduce: Helpers::IsoToSolrFormat::MAX_SPATIAL_AREA,
65
+ format: Helpers::IsoToSolrFormat::SPATIAL_AREA
66
+ },
67
+ temporal: {
68
+ xpaths: ['.//dif:Temporal_Coverage'],
69
+ multivalue: true,
70
+ format: Helpers::IsoToSolrFormat::TEMPORAL_INDEX_STRING
71
+ },
72
+ temporal_coverages: {
73
+ xpaths: ['.//dif:Temporal_Coverage'],
74
+ multivalue: true,
75
+ format: Helpers::IsoToSolrFormat::TEMPORAL_DISPLAY_STRING
76
+ },
77
+ temporal_duration: {
78
+ xpaths: ['.//dif:Temporal_Coverage'],
79
+ multivalue: false,
80
+ reduce: Helpers::SolrFormat::REDUCE_TEMPORAL_DURATION,
81
+ format: Helpers::IsoToSolrFormat::TEMPORAL_DURATION
82
+ },
83
+ source: {
84
+ xpaths: [''],
85
+ default_values: ['ADE'],
86
+ multivalue: false
87
+ },
88
+ facet_data_center: {
89
+ xpaths: [''],
90
+ default_values: ["#{Helpers::SolrFormat::DATA_CENTER_NAMES[:NMI][:long_name]} | #{Helpers::SolrFormat::DATA_CENTER_NAMES[:NMI][:short_name]}"],
91
+ multivalue: false
92
+ },
93
+ facet_spatial_scope: {
94
+ xpaths: ['.//dif:Spatial_Coverage'],
95
+ multivalue: true,
96
+ format: Helpers::IsoToSolrFormat::FACET_SPATIAL_SCOPE
97
+ },
98
+ facet_temporal_duration: {
99
+ xpaths: ['.//dif:Temporal_Coverage'],
100
+ default_values: [Helpers::SolrFormat::NOT_SPECIFIED],
101
+ format: Helpers::IsoToSolrFormat::FACET_TEMPORAL_DURATION,
102
+ multivalue: true
103
+ }
104
+ }
105
+ end
106
+ end