From 1a4e61e3054d80b37f30e346aaa6cdf36ea5b12e Mon Sep 17 00:00:00 2001 From: Bilel KIHAL Date: Wed, 9 Oct 2024 15:51:34 +0200 Subject: [PATCH] add test for federated search --- test/models/test_federation.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/models/test_federation.rb b/test/models/test_federation.rb index e29f65c..600f2bf 100644 --- a/test/models/test_federation.rb +++ b/test/models/test_federation.rb @@ -119,4 +119,21 @@ def test_federation_ssl_error refute_nil ontologies_federate_one.first.errors WebMock.disable! end + + def test_federated_search + query = 'test' + + time1 = Benchmark.realtime do + @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] + end + + 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 + end end