Skip to content

Commit

Permalink
add index_all step to submission parsing steps
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Apr 19, 2024
1 parent 80a2d3f commit 5e70088
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ def generate_diff(logger)
LinkedData::Services::SubmissionDiffGenerator.new(self).process(logger)
end

def index_all(logger, commit: true)
LinkedData::Services::OntologySubmissionAllDataIndexer.new(self).process(logger, commit: commit)
end

def index_terms(logger, commit: true, optimize: true)
LinkedData::Services::OntologySubmissionIndexer.new(self).process(logger, commit: commit, optimize: optimize)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ def process_submission(logger, options = {})

parsed = @submission.ready?(status: %i[rdf rdf_labels])

if process_index_all_data?(options)
unless parsed
raise StandardError, "The submission #{@submission.ontology.acronym}/submissions/#{@submission.submissionId}
cannot be indexed because it has not been successfully parsed"
end

@submission.index_all(logger, commit: process_index_commit?(options))
end


if process_index_search?(options)
unless parsed
raise StandardError, "The submission #{@submission.ontology.acronym}/submissions/#{@submission.submissionId}
Expand Down Expand Up @@ -95,6 +105,10 @@ def process_rdf?(options)
options.empty? || options[:process_rdf].eql?(true)
end

def process_index_all_data?(options)
options.empty? || options[:index_all_data].eql?(true)
end

def process_index_search?(options)
options.empty? || options[:index_search].eql?(true)
end
Expand All @@ -104,7 +118,7 @@ def process_index_properties?(options)
end

def process_index_commit?(options)
options.empty? || (process_index_search?(options) || process_index_properties?(options))
options.empty? || (process_index_search?(options) || process_index_properties?(options) || process_index_all_data?(options))
end

def process_diff?(options)
Expand Down
6 changes: 2 additions & 4 deletions test/models/test_search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ def test_search_ontology_data
process_rdf: true, extract_metadata: false,
generate_missing_labels: false,
index_search: false,
index_all_data: true
},
acronym: 'BROTEST',
name: 'ontTEST Bla',
Expand All @@ -142,10 +143,7 @@ def test_search_ontology_data
})
ont_sub = LinkedData::Models::Ontology.find('BROTEST-0').first
ont_sub = ont_sub.latest_submission
time = Benchmark.realtime do
ont_sub.index_all_data(Logger.new($stdout))
end
puts time

conn = Goo.search_client(:ontology_data)
response = conn.search('*')

Expand Down

0 comments on commit 5e70088

Please sign in to comment.