Skip to content

Commit

Permalink
Fix: Return search results as an object instead of a hash (#21)
Browse files Browse the repository at this point in the history
* return search results as an object instad of a hash

* update test federated search to use search results as an object instead of a hash

* fix tests timeout by using the dev server of biodivportal

---------

Co-authored-by: Syphax <[email protected]>
  • Loading branch information
Bilelkihal and syphax-bouazzouni authored Oct 26, 2024
1 parent 8788515 commit 65ac0d6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion config/config.test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# color: '#1e2251',
# },
biodivportal: {
api: 'https://data.biodivportal.gfbio.org/',
api: 'https://data.biodivportal.gfbio.dev/',
apikey: "47a57aa3-7b54-4f34-b695-dbb5f5b7363e",
color: '#1e2251',
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ontologies_api_client/models/class.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def self.search(*args)
merged_collections[:errors] << result.errors
end
end
merged_collections
OpenStruct.new(merged_collections)

end

Expand Down
6 changes: 3 additions & 3 deletions test/models/test_federation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ def test_federated_search
query = 'test'

time1 = Benchmark.realtime do
@search_results = LinkedData::Client::Models::Class.search(query)[:collection]
@search_results = LinkedData::Client::Models::Class.search(query).collection
end

time2 = Benchmark.realtime do
@federated_search_results = LinkedData::Client::Models::Class.search(query, {federate: 'true'})[:collection]
@federated_search_results = LinkedData::Client::Models::Class.search(query, {federate: 'true'}).collection
end

puts "Search results: #{@search_results .length} in #{time1}s"
puts "Search results: #{@search_results.length} in #{time1}s"
puts "Federated search results: #{@federated_search_results.length} in #{time2}s"

refute_equal @search_results.length, @federated_search_results.length
Expand Down

0 comments on commit 65ac0d6

Please sign in to comment.