base_indexer 0.1 → 0.1.2
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/initializers/base_indexer.rb +4 -2
- data/lib/base_indexer/engine.rb +1 -1
- data/lib/base_indexer/main_indexer_engine.rb +10 -23
- data/lib/base_indexer/version.rb +1 -1
- data/lib/base_indexer.rb +4 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2673b29c0df7935516e09dcfea5cb5c8a2986785
|
|
4
|
+
data.tar.gz: 0cf28efde5d3fa7cf912a3476b779a9033fdce20
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0e0d8a9fac9445125d7377e091928448b9d3aa4e09fd916be3f7c9d26c45c87e9c8e03ae57bbd99e35b56031656889d4daa573f665d123708d1124fc4cdfebdb
|
|
7
|
+
data.tar.gz: 814399093a3259a2095240dd1afecaa7e090990d629213e5cb5c976f03326fd21b4c5eac6f6884d1d0409d9a374b3eada6ae4fb3104afdfb4a48ce152eb4b2dc
|
|
@@ -2,5 +2,7 @@
|
|
|
2
2
|
# Define the indexer class that will be used by the engine.
|
|
3
3
|
# The engine consumer app should override this class
|
|
4
4
|
BaseIndexer.indexer_class = "BaseIndexer::MainIndexerEngine"
|
|
5
|
-
BaseIndexer.
|
|
6
|
-
#BaseIndexer.solr_configuration_class.constantize.new(Rails.configuration.solr_config_file_path)
|
|
5
|
+
BaseIndexer.solr_configuration_class_name = "BaseIndexer::SolrConfigurationFromFile"
|
|
6
|
+
#BaseIndexer.solr_configuration_class.constantize.new(Rails.configuration.solr_config_file_path)
|
|
7
|
+
BaseIndexer.mapper_class_name = "DiscoveryIndexer::Mapper::GeneralMapper"
|
|
8
|
+
BaseIndexer.solr_writer_class_name = "DiscoveryIndexer::Writer::SolrWriter"
|
data/lib/base_indexer/engine.rb
CHANGED
|
@@ -6,7 +6,7 @@ module BaseIndexer
|
|
|
6
6
|
# Initialize memory store cache with 50 MB size
|
|
7
7
|
config.cache_store = [:memory_store, {:size => 64.megabytes }]
|
|
8
8
|
config.after_initialize do
|
|
9
|
-
BaseIndexer.
|
|
9
|
+
BaseIndexer.solr_configuration_class_name.constantize.instance.read(Rails.configuration.solr_config_file_path ||= 'test')
|
|
10
10
|
DiscoveryIndexer::Logging.logger = Rails.logger
|
|
11
11
|
end
|
|
12
12
|
end
|
|
@@ -4,11 +4,15 @@ module BaseIndexer
|
|
|
4
4
|
include DiscoveryIndexer
|
|
5
5
|
|
|
6
6
|
def index druid, targets
|
|
7
|
+
# Read input mods and purl
|
|
7
8
|
purl_model = read_purl(druid)
|
|
8
9
|
mods_model = read_mods(druid)
|
|
9
10
|
collection_names = get_collection_names(purl_model.collection_druids)
|
|
10
|
-
solr_doc = map(druid, mods_model, purl_model, collection_names)
|
|
11
11
|
|
|
12
|
+
# Map the input to solr_doc
|
|
13
|
+
solr_doc = BaseIndexer.mapper_class_name.constantize.new(druid, mods_model, purl_model, collection_names).map
|
|
14
|
+
|
|
15
|
+
# Get target list
|
|
12
16
|
targets_hash={}
|
|
13
17
|
if targets.nil? or targets.length == 0
|
|
14
18
|
targets_hash = purl_model.release_tags_hash
|
|
@@ -16,12 +20,14 @@ module BaseIndexer
|
|
|
16
20
|
targets_hash = get_targets_hash_from_param(targets)
|
|
17
21
|
end
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
# Get SOLR configuration and write
|
|
24
|
+
solr_targets_configs = BaseIndexer.solr_configuration_class_name.constantize.instance.get_configuration_hash
|
|
25
|
+
BaseIndexer.solr_writer_class_name.constantize.new.process( druid, solr_doc, targets_hash, solr_targets_configs)
|
|
20
26
|
end
|
|
21
27
|
|
|
22
28
|
def delete druid
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
solr_targets_configs = BaseIndexer.solr_configuration_class_name.constantize.instance.get_configuration_hash
|
|
30
|
+
BaseIndexer.solr_writer_class_name.constantize.new.solr_delete_from_all( druid, solr_targets_configs)
|
|
25
31
|
end
|
|
26
32
|
|
|
27
33
|
def read_purl druid
|
|
@@ -32,16 +38,6 @@ module BaseIndexer
|
|
|
32
38
|
return DiscoveryIndexer::InputXml::Modsxml.new(druid).load()
|
|
33
39
|
end
|
|
34
40
|
|
|
35
|
-
def map druid, mods_model, purl_model, collection_names
|
|
36
|
-
return DiscoveryIndexer::Mapper::IndexerlMapper.new(druid, mods_model, purl_model, collection_name).map
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def write druid, solr_doc, targets, solr_targets_configs
|
|
40
|
-
solr_writer = DiscoveryIndexer::Writer::SolrWriter.new
|
|
41
|
-
solr_writer.process( druid, solr_doc, targets, solr_targets_configs)
|
|
42
|
-
#DiscoveryIndexer::Writer::SolrClient.add(solr_doc, solr_connector)
|
|
43
|
-
end
|
|
44
|
-
|
|
45
41
|
def get_targets_hash_from_param(targets)
|
|
46
42
|
targets_hash = {}
|
|
47
43
|
targets.each do |target|
|
|
@@ -50,15 +46,6 @@ module BaseIndexer
|
|
|
50
46
|
return targets_hash
|
|
51
47
|
end
|
|
52
48
|
|
|
53
|
-
# def get_targets_hash_from_release_tags release_tags
|
|
54
|
-
# indexer_target_name = "Robot_Testing_Feb_5_2015"
|
|
55
|
-
# return DiscoveryIndexer::Utilities::ExtractSubTargets.by_name(indexer_target_name,release_tags )
|
|
56
|
-
# end
|
|
57
|
-
|
|
58
|
-
def get_solr_targets_configs
|
|
59
|
-
return BaseIndexer.solr_configuration_class.constantize.instance.get_configuration_hash
|
|
60
|
-
end
|
|
61
|
-
|
|
62
49
|
def get_collection_names collection_druids
|
|
63
50
|
collection_names = {}
|
|
64
51
|
|
data/lib/base_indexer/version.rb
CHANGED
data/lib/base_indexer.rb
CHANGED
|
@@ -7,6 +7,9 @@ require "base_indexer/collection"
|
|
|
7
7
|
require 'discovery-indexer'
|
|
8
8
|
module BaseIndexer
|
|
9
9
|
mattr_accessor :indexer_class
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
mattr_accessor :mapper_class_name
|
|
12
|
+
mattr_accessor :solr_writer_class_name
|
|
13
|
+
mattr_accessor :solr_configuration_class_name
|
|
11
14
|
end
|
|
12
15
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: base_indexer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ahmed Alsum
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-03-
|
|
11
|
+
date: 2015-03-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|