supplejack_api 1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +80 -0
- data/Rakefile +42 -0
- data/app/assets/javascripts/supplejack_api/application.js +26 -0
- data/app/assets/stylesheets/supplejack_api/application.css +30 -0
- data/app/controllers/supplejack_api/admin/base_controller.rb +24 -0
- data/app/controllers/supplejack_api/admin/sessions_controller.rb +25 -0
- data/app/controllers/supplejack_api/admin/site_activities_controller.rb +21 -0
- data/app/controllers/supplejack_api/admin/users_controller.rb +55 -0
- data/app/controllers/supplejack_api/application_controller.rb +70 -0
- data/app/controllers/supplejack_api/concepts_controller.rb +52 -0
- data/app/controllers/supplejack_api/concerns/ignore_metrics.rb +14 -0
- data/app/controllers/supplejack_api/concerns/records_controller_metrics.rb +26 -0
- data/app/controllers/supplejack_api/concerns/set_items_controller_metrics.rb +20 -0
- data/app/controllers/supplejack_api/concerns/user_sets_controller_metrics.rb +26 -0
- data/app/controllers/supplejack_api/harvester/concepts_controller.rb +41 -0
- data/app/controllers/supplejack_api/harvester/fragments_controller.rb +30 -0
- data/app/controllers/supplejack_api/harvester/records_controller.rb +68 -0
- data/app/controllers/supplejack_api/metrics_api_controller.rb +44 -0
- data/app/controllers/supplejack_api/partners_controller.rb +39 -0
- data/app/controllers/supplejack_api/records_controller.rb +71 -0
- data/app/controllers/supplejack_api/schema_controller.rb +19 -0
- data/app/controllers/supplejack_api/set_items_controller.rb +38 -0
- data/app/controllers/supplejack_api/sources_controller.rb +67 -0
- data/app/controllers/supplejack_api/status_controller.rb +67 -0
- data/app/controllers/supplejack_api/user_sets_controller.rb +97 -0
- data/app/controllers/supplejack_api/users_controller.rb +49 -0
- data/app/helpers/supplejack_api/application_helper.rb +39 -0
- data/app/helpers/supplejack_api/facets_helper.rb +30 -0
- data/app/mailers/supplejack_api/request_limit_mailer.rb +43 -0
- data/app/models/supplejack_api/api_concept/concept_fragment.rb +31 -0
- data/app/models/supplejack_api/api_record/record_fragment.rb +15 -0
- data/app/models/supplejack_api/concept.rb +46 -0
- data/app/models/supplejack_api/concept_search.rb +86 -0
- data/app/models/supplejack_api/concerns/queryable_by_date.rb +31 -0
- data/app/models/supplejack_api/concerns/record.rb +108 -0
- data/app/models/supplejack_api/concerns/record_fragmentable.rb +24 -0
- data/app/models/supplejack_api/concerns/searchable.rb +430 -0
- data/app/models/supplejack_api/concerns/user_set.rb +219 -0
- data/app/models/supplejack_api/daily_metrics.rb +20 -0
- data/app/models/supplejack_api/faceted_metrics.rb +55 -0
- data/app/models/supplejack_api/fragment.rb +82 -0
- data/app/models/supplejack_api/interaction_models/record.rb +60 -0
- data/app/models/supplejack_api/interaction_models/set.rb +13 -0
- data/app/models/supplejack_api/interaction_updaters/all_usage_metric.rb +41 -0
- data/app/models/supplejack_api/interaction_updaters/set_metrics.rb +32 -0
- data/app/models/supplejack_api/interaction_updaters/usage_metrics.rb +73 -0
- data/app/models/supplejack_api/partner.rb +24 -0
- data/app/models/supplejack_api/preview_record.rb +30 -0
- data/app/models/supplejack_api/record.rb +18 -0
- data/app/models/supplejack_api/record_search.rb +12 -0
- data/app/models/supplejack_api/schema_definition.rb +147 -0
- data/app/models/supplejack_api/search.rb +14 -0
- data/app/models/supplejack_api/set_item.rb +57 -0
- data/app/models/supplejack_api/site_activity.rb +59 -0
- data/app/models/supplejack_api/source.rb +28 -0
- data/app/models/supplejack_api/source_activity.rb +36 -0
- data/app/models/supplejack_api/source_authority.rb +42 -0
- data/app/models/supplejack_api/supplejack_schema.rb +37 -0
- data/app/models/supplejack_api/support/concept/searchable.rb +79 -0
- data/app/models/supplejack_api/support/concept/storable.rb +59 -0
- data/app/models/supplejack_api/support/fragment_helpers.rb +96 -0
- data/app/models/supplejack_api/support/harvestable.rb +105 -0
- data/app/models/supplejack_api/support/searchable.rb +115 -0
- data/app/models/supplejack_api/support/status_logger.rb +23 -0
- data/app/models/supplejack_api/support/storable.rb +49 -0
- data/app/models/supplejack_api/support/validation_logger.rb +23 -0
- data/app/models/supplejack_api/usage_metrics.rb +25 -0
- data/app/models/supplejack_api/user.rb +211 -0
- data/app/models/supplejack_api/user_activity.rb +65 -0
- data/app/models/supplejack_api/user_set.rb +17 -0
- data/app/serializers/supplejack_api/application_serializer.rb +12 -0
- data/app/serializers/supplejack_api/concept_record_serializer.rb +23 -0
- data/app/serializers/supplejack_api/concept_search_serializer.rb +12 -0
- data/app/serializers/supplejack_api/concept_serializer.rb +100 -0
- data/app/serializers/supplejack_api/concerns/record_serializable.rb +119 -0
- data/app/serializers/supplejack_api/concerns/search_serializable.rb +24 -0
- data/app/serializers/supplejack_api/record_search_serializer.rb +64 -0
- data/app/serializers/supplejack_api/record_serializer.rb +13 -0
- data/app/serializers/supplejack_api/search_serializer.rb +13 -0
- data/app/serializers/supplejack_api/source_authority_serializer.rb +23 -0
- data/app/serializers/supplejack_api/user_serializer.rb +13 -0
- data/app/serializers/supplejack_api/user_set_record_serializer.rb +14 -0
- data/app/serializers/supplejack_api/user_set_serializer.rb +77 -0
- data/app/services/metrics_api/v3/api.rb +30 -0
- data/app/services/metrics_api/v3/endpoints/facets.rb +23 -0
- data/app/services/metrics_api/v3/endpoints/global.rb +26 -0
- data/app/services/metrics_api/v3/endpoints/helpers.rb +14 -0
- data/app/services/metrics_api/v3/endpoints/root.rb +97 -0
- data/app/services/metrics_api/v3/presenters/daily_metric.rb +23 -0
- data/app/services/metrics_api/v3/presenters/extended_metadata.rb +41 -0
- data/app/services/metrics_api/v3/presenters/record.rb +26 -0
- data/app/services/metrics_api/v3/presenters/view.rb +28 -0
- data/app/views/layouts/supplejack_api/_head.html.erb +17 -0
- data/app/views/layouts/supplejack_api/_top_nav.html.erb +33 -0
- data/app/views/layouts/supplejack_api/application.html.erb +33 -0
- data/app/views/supplejack_api/admin/sessions/new.html.erb +25 -0
- data/app/views/supplejack_api/admin/shared/_links.erb +34 -0
- data/app/views/supplejack_api/admin/site_activities/index.csv.erb +22 -0
- data/app/views/supplejack_api/admin/site_activities/index.html.erb +54 -0
- data/app/views/supplejack_api/admin/users/edit.html.erb +16 -0
- data/app/views/supplejack_api/admin/users/index.csv.erb +22 -0
- data/app/views/supplejack_api/admin/users/index.html.erb +57 -0
- data/app/views/supplejack_api/admin/users/show.html.erb +33 -0
- data/app/views/supplejack_api/request_limit_mailer/at100percent.text.erb +13 -0
- data/app/views/supplejack_api/request_limit_mailer/at100percent_admin.text.erb +1 -0
- data/app/views/supplejack_api/request_limit_mailer/at90percent.text.erb +13 -0
- data/app/views/supplejack_api/request_limit_mailer/at90percent_admin.text.erb +1 -0
- data/app/workers/supplejack_api/daily_metrics_worker.rb +112 -0
- data/app/workers/supplejack_api/interaction_metrics_worker.rb +45 -0
- data/config/cucumber.yml +16 -0
- data/config/initializers/force_eagerload.rb +11 -0
- data/config/initializers/interaction_updaters.rb +7 -0
- data/config/routes.rb +81 -0
- data/db/binding_records.development.json +7 -0
- data/db/binding_records.staging.json +7 -0
- data/db/concepts.json +33 -0
- data/db/concepts_data.json +569745 -0
- data/db/source_authorities.json +119 -0
- data/lib/generators/supplejack_api/install_generator.rb +124 -0
- data/lib/mongoid/paperclip.rb +53 -0
- data/lib/mongoid/string.rb +20 -0
- data/lib/sunspot/mongoid.rb +51 -0
- data/lib/sunspot/resque_session_proxy.rb +72 -0
- data/lib/sunspot/sunspot_spellcheck.rb +98 -0
- data/lib/supplejack_api.rb +13 -0
- data/lib/supplejack_api/admin/sortable.rb +40 -0
- data/lib/supplejack_api/engine.rb +46 -0
- data/lib/supplejack_api/harvester_constraint.rb +28 -0
- data/lib/supplejack_api/stylesheets.rb +36 -0
- data/lib/supplejack_api/utils.rb +75 -0
- data/lib/supplejack_api/version.rb +11 -0
- data/lib/tasks/resque.rake +22 -0
- data/lib/url_validator.rb +38 -0
- data/spec/controllers/supplejack_api/admin/base_controller_spec.rb +55 -0
- data/spec/controllers/supplejack_api/admin/site_activities_controller_spec.rb +43 -0
- data/spec/controllers/supplejack_api/admin/users_controller_spec.rb +79 -0
- data/spec/controllers/supplejack_api/application_controller_spec.rb +133 -0
- data/spec/controllers/supplejack_api/concepts_controller_spec.rb +83 -0
- data/spec/controllers/supplejack_api/concerns/records_controller_metrics_spec.rb +60 -0
- data/spec/controllers/supplejack_api/harvester/concepts_controller_spec.rb +57 -0
- data/spec/controllers/supplejack_api/harvester/records_controller_spec.rb +138 -0
- data/spec/controllers/supplejack_api/metrics_api_controller_spec.rb +71 -0
- data/spec/controllers/supplejack_api/partners_controller_spec.rb +77 -0
- data/spec/controllers/supplejack_api/records_controller_spec.rb +143 -0
- data/spec/controllers/supplejack_api/set_items_controller_spec.rb +78 -0
- data/spec/controllers/supplejack_api/sources_controller_spec.rb +161 -0
- data/spec/controllers/supplejack_api/status_controller_spec.rb +120 -0
- data/spec/controllers/supplejack_api/user_sets_controller_spec.rb +233 -0
- data/spec/controllers/supplejack_api/users_controller_spec.rb +61 -0
- data/spec/dummy/README.rdoc +268 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +23 -0
- data/spec/dummy/app/assets/stylesheets/application.css +22 -0
- data/spec/dummy/app/controllers/application_controller.rb +10 -0
- data/spec/dummy/app/helpers/application_helper.rb +9 -0
- data/spec/dummy/app/supplejack_api/concept_schema.rb +83 -0
- data/spec/dummy/app/supplejack_api/record_schema.rb +64 -0
- data/spec/dummy/app/supplejack_api/record_schema.txt +66 -0
- data/spec/dummy/app/views/layouts/application.html.erb +23 -0
- data/spec/dummy/app/workers/supplejack_api/clear_index_buffer.rb +32 -0
- data/spec/dummy/app/workers/supplejack_api/flush_old_records_worker.rb +17 -0
- data/spec/dummy/app/workers/supplejack_api/index_buffer.rb +49 -0
- data/spec/dummy/app/workers/supplejack_api/index_source_worker.rb +39 -0
- data/spec/dummy/app/workers/supplejack_api/index_worker.rb +82 -0
- data/spec/dummy/app/workers/supplejack_api/store_user_activity_worker.rb +24 -0
- data/spec/dummy/config.ru +11 -0
- data/spec/dummy/config/application.rb +76 -0
- data/spec/dummy/config/application.yml +31 -0
- data/spec/dummy/config/application.yml.example +36 -0
- data/spec/dummy/config/boot.rb +17 -0
- data/spec/dummy/config/environment.rb +12 -0
- data/spec/dummy/config/environments/development.rb +42 -0
- data/spec/dummy/config/environments/production.rb +76 -0
- data/spec/dummy/config/environments/test.rb +46 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +14 -0
- data/spec/dummy/config/initializers/devise.rb +214 -0
- data/spec/dummy/config/initializers/inflections.rb +22 -0
- data/spec/dummy/config/initializers/kaminari_config.rb +17 -0
- data/spec/dummy/config/initializers/mime_types.rb +12 -0
- data/spec/dummy/config/initializers/mongoid.rb +9 -0
- data/spec/dummy/config/initializers/quiet_logger.rb +23 -0
- data/spec/dummy/config/initializers/resque.rb +18 -0
- data/spec/dummy/config/initializers/secret_token.rb +14 -0
- data/spec/dummy/config/initializers/session_store.rb +15 -0
- data/spec/dummy/config/initializers/simple_form.rb +149 -0
- data/spec/dummy/config/initializers/simple_form_foundation.rb +33 -0
- data/spec/dummy/config/initializers/state_machine.rb +8 -0
- data/spec/dummy/config/initializers/sunspot.rb +32 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +17 -0
- data/spec/dummy/config/locales/devise.en.yml +63 -0
- data/spec/dummy/config/locales/en.yml +66 -0
- data/spec/dummy/config/locales/simple_form.en.yml +33 -0
- data/spec/dummy/config/mongoid.travis.yml +34 -0
- data/spec/dummy/config/mongoid.yml +36 -0
- data/spec/dummy/config/resque-pool.yml +18 -0
- data/spec/dummy/config/resque_schedule.yml +12 -0
- data/spec/dummy/config/routes.rb +11 -0
- data/spec/dummy/config/secrets.yml +8 -0
- data/spec/dummy/config/sunspot.yml +38 -0
- data/spec/dummy/db/concepts.json +37 -0
- data/spec/dummy/db/source_authorities.json +116 -0
- data/spec/dummy/public/404.html +35 -0
- data/spec/dummy/public/422.html +35 -0
- data/spec/dummy/public/500.html +34 -0
- data/spec/dummy/public/favicon.ico +8 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/dummy/solr/collection1/conf/elevate.xml +36 -0
- data/spec/dummy/solr/collection1/conf/mapping-FoldToASCII.txt +3813 -0
- data/spec/dummy/solr/collection1/conf/schema.xml +292 -0
- data/spec/dummy/solr/collection1/conf/solrconfig.xml +1780 -0
- data/spec/dummy/solr/collection1/conf/spellings.txt +2 -0
- data/spec/dummy/solr/collection1/conf/stopwords.txt +58 -0
- data/spec/dummy/solr/collection1/conf/synonyms.txt +31 -0
- data/spec/factories/concepts.rb +16 -0
- data/spec/factories/daily_metrics.rb +10 -0
- data/spec/factories/faceted_metrics.rb +25 -0
- data/spec/factories/fragment.rb +14 -0
- data/spec/factories/partners.rb +14 -0
- data/spec/factories/record_interaction.rb +17 -0
- data/spec/factories/records.rb +47 -0
- data/spec/factories/set_interaction.rb +15 -0
- data/spec/factories/source_authorities.rb +19 -0
- data/spec/factories/sources.rb +16 -0
- data/spec/factories/usage_metrics.rb +20 -0
- data/spec/factories/user_activities.rb +14 -0
- data/spec/factories/user_sets.rb +27 -0
- data/spec/factories/users.rb +23 -0
- data/spec/helpers/application_helper_spec.rb +35 -0
- data/spec/models/concept_spec.rb +163 -0
- data/spec/models/fragment_spec.rb +15 -0
- data/spec/models/site_activity_spec.rb +103 -0
- data/spec/models/source_activity_spec.rb +56 -0
- data/spec/models/source_authority_spec.rb +42 -0
- data/spec/models/supplejack_api/api_concept/concept_fragment_spec.rb +189 -0
- data/spec/models/supplejack_api/api_record/record_fragment_spec.rb +189 -0
- data/spec/models/supplejack_api/concept_spec.rb +0 -0
- data/spec/models/supplejack_api/interaction_updaters/all_usage_metric_spec.rb +41 -0
- data/spec/models/supplejack_api/interaction_updaters/set_metrics_spec.rb +32 -0
- data/spec/models/supplejack_api/interaction_updaters/usage_metrics_spec.rb +44 -0
- data/spec/models/supplejack_api/partner_spec.rb +20 -0
- data/spec/models/supplejack_api/record_search_spec.rb +429 -0
- data/spec/models/supplejack_api/record_spec.rb +280 -0
- data/spec/models/supplejack_api/schema_definition_spec.rb +272 -0
- data/spec/models/supplejack_api/search_spec.rb +243 -0
- data/spec/models/supplejack_api/set_item_spec.rb +123 -0
- data/spec/models/supplejack_api/source_spec.rb +22 -0
- data/spec/models/supplejack_api/support/fragment_helpers_spec.rb +216 -0
- data/spec/models/supplejack_api/support/harvestable_spec.rb +177 -0
- data/spec/models/supplejack_api/support/searchable_spec.rb +85 -0
- data/spec/models/supplejack_api/support/storable_spec.rb +18 -0
- data/spec/models/supplejack_api/user_activity_spec.rb +88 -0
- data/spec/models/supplejack_api/user_set_spec.rb +559 -0
- data/spec/models/supplejack_api/user_spec.rb +348 -0
- data/spec/routing/concepts_routing_spec.rb +22 -0
- data/spec/routing/harvester_constraint_spec.rb +66 -0
- data/spec/routing/harvester_routing_spec.rb +51 -0
- data/spec/routing/partner_routing_spec.rb +34 -0
- data/spec/routing/records_routing_spec.rb +26 -0
- data/spec/routing/sets_routing_spec.rb +44 -0
- data/spec/routing/source_routing_spec.rb +38 -0
- data/spec/routing/users_routing_spec.rb +18 -0
- data/spec/serializers/concept_record_serializer_spec.rb +30 -0
- data/spec/serializers/supplejack_api/application_serializer_spec.rb +14 -0
- data/spec/serializers/supplejack_api/concept_search_serializer_spec.rb +34 -0
- data/spec/serializers/supplejack_api/concept_serializer_spec.rb +92 -0
- data/spec/serializers/supplejack_api/record_search_serializer_spec.rb +34 -0
- data/spec/serializers/supplejack_api/record_serializer_spec.rb +271 -0
- data/spec/serializers/supplejack_api/search_serializer_spec.rb +90 -0
- data/spec/serializers/supplejack_api/user_serializer_spec.rb +22 -0
- data/spec/serializers/supplejack_api/user_set_serializer_spec.rb +96 -0
- data/spec/services/metrics_api/v3/api_spec.rb +23 -0
- data/spec/services/metrics_api/v3/endpoints/facets_spec.rb +25 -0
- data/spec/services/metrics_api/v3/endpoints/global_spec.rb +22 -0
- data/spec/services/metrics_api/v3/endpoints/root_spec.rb +49 -0
- data/spec/services/metrics_api/v3/presenters/extended_metadata_spec.rb +49 -0
- data/spec/spec_helper.rb +70 -0
- data/spec/support/api/schemas/metrics/daily_metrics_metadata.json +24 -0
- data/spec/support/api/schemas/metrics/extended_metrics.json +26 -0
- data/spec/support/api/schemas/metrics/extended_response.json +6 -0
- data/spec/support/api/schemas/metrics/facets_response.json +6 -0
- data/spec/support/api/schemas/metrics/record_metadata.json +33 -0
- data/spec/support/api/schemas/metrics/top_level_response.json +6 -0
- data/spec/support/api/schemas/metrics/view_metadata.json +33 -0
- data/spec/support/api_schema_matcher.rb +14 -0
- data/spec/support/devise.rb +10 -0
- data/spec/workers/supplejack_api/daily_metrics_worker_spec.rb +140 -0
- data/spec/workers/supplejack_api/flush_old_records_worker_spec.rb +20 -0
- data/spec/workers/supplejack_api/index_worker_spec.rb +52 -0
- data/spec/workers/supplejack_api/source_index_worker_spec.rb +61 -0
- metadata +1231 -0
File without changes
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module SupplejackApi
|
4
|
+
module InteractionUpdaters
|
5
|
+
describe AllUsageMetric do
|
6
|
+
let(:updater){InteractionUpdaters::AllUsageMetric.new}
|
7
|
+
let!(:usage_metrics) {[create(:usage_metrics, record_field_value: '1'), create(:usage_metrics, record_field_value: '2')]}
|
8
|
+
let(:all_usage_metric) {SupplejackApi::UsageMetrics.where(record_field_value: 'all').last}
|
9
|
+
|
10
|
+
it 'creates a new "all" usage metric with the summed values of the other usage metrics if one does not exist' do
|
11
|
+
updater.process
|
12
|
+
|
13
|
+
expect(all_usage_metric.searches).to eq(2)
|
14
|
+
expect(all_usage_metric.gets).to eq(2)
|
15
|
+
expect(all_usage_metric.user_set_views).to eq(2)
|
16
|
+
expect(all_usage_metric.total_views).to eq(2)
|
17
|
+
expect(all_usage_metric.records_added_to_user_sets).to eq(2)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'updates the "all" usage metric with the summed values of the other usage metrics if one does exist' do
|
21
|
+
create(:usage_metrics, record_field_value: 'all')
|
22
|
+
|
23
|
+
updater.process
|
24
|
+
|
25
|
+
expect(all_usage_metric.searches).to eq(2)
|
26
|
+
expect(all_usage_metric.gets).to eq(2)
|
27
|
+
expect(all_usage_metric.user_set_views).to eq(2)
|
28
|
+
expect(all_usage_metric.total_views).to eq(2)
|
29
|
+
expect(all_usage_metric.records_added_to_user_sets).to eq(2)
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'does not process UsageMetrics created in the past' do
|
33
|
+
create(:usage_metrics, date: Date.yesterday)
|
34
|
+
|
35
|
+
updater.process
|
36
|
+
|
37
|
+
expect(all_usage_metric.searches).to eq(2)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module SupplejackApi
|
4
|
+
module InteractionUpdaters
|
5
|
+
describe SetMetrics do
|
6
|
+
let(:updater){InteractionUpdaters::SetMetrics.new}
|
7
|
+
|
8
|
+
before do
|
9
|
+
@set_interactions = ['test1', 'test2', 'test1'].map do |collection|
|
10
|
+
create(:set_interaction, facet: collection)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'takes an array of Set interactions and creates a UsageMetrics model' do
|
15
|
+
updater.process(@set_interactions)
|
16
|
+
metric = SupplejackApi::UsageMetrics.first
|
17
|
+
|
18
|
+
expect(metric).to be_present
|
19
|
+
expect(metric.record_field_value).to eq('test1')
|
20
|
+
expect(metric.records_added_to_user_sets).to eq(2)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'updates an existing UsageMetrics model if one exists' do
|
24
|
+
create(:usage_metrics, record_field_value: 'test1', records_added_to_user_sets: 2, date: Date.current)
|
25
|
+
updater.process(@set_interactions)
|
26
|
+
metric = SupplejackApi::UsageMetrics.first
|
27
|
+
|
28
|
+
expect(metric.records_added_to_user_sets).to eq(4)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module SupplejackApi
|
4
|
+
module InteractionUpdaters
|
5
|
+
describe UsageMetrics do
|
6
|
+
let(:updater) {InteractionUpdaters::UsageMetrics.new}
|
7
|
+
|
8
|
+
before do
|
9
|
+
@request_logs = ['search', 'get', 'user_set'].map do |request_type|
|
10
|
+
create(:record_interaction, request_type: request_type, log_values: ['test'])
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'takes an array of Record interactions and creates a UsageMetrics model' do
|
15
|
+
updater.process(@request_logs)
|
16
|
+
metric = SupplejackApi::UsageMetrics.first
|
17
|
+
|
18
|
+
expect(metric).to be_present
|
19
|
+
expect(metric.record_field_value).to eq('test')
|
20
|
+
expect(metric.searches ).to eq(1)
|
21
|
+
expect(metric.gets ).to eq(1)
|
22
|
+
expect(metric.user_set_views).to eq(1)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'updates an existing UsageMetrics model if one exists' do
|
26
|
+
create(:usage_metrics,
|
27
|
+
record_field_value: 'test',
|
28
|
+
searches: 1,
|
29
|
+
gets: 1,
|
30
|
+
user_set_views: 1,
|
31
|
+
total_views: 3,
|
32
|
+
date: Date.current
|
33
|
+
)
|
34
|
+
updater.process(@request_logs)
|
35
|
+
metric = SupplejackApi::UsageMetrics.first
|
36
|
+
|
37
|
+
expect(metric.searches ).to eq(2)
|
38
|
+
expect(metric.gets ).to eq(2)
|
39
|
+
expect(metric.user_set_views).to eq(2)
|
40
|
+
expect(metric.total_views ).to eq(6)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# The majority of the Supplejack API code is Crown copyright (C) 2014, New Zealand Government,
|
2
|
+
# and is licensed under the GNU General Public License, version 3.
|
3
|
+
# One component is a third party component. See https://github.com/DigitalNZ/supplejack_api for details.
|
4
|
+
#
|
5
|
+
# Supplejack was created by DigitalNZ at the National Library of NZ and
|
6
|
+
# the Department of Internal Affairs. http://digitalnz.org/supplejack
|
7
|
+
|
8
|
+
require 'spec_helper'
|
9
|
+
|
10
|
+
module SupplejackApi
|
11
|
+
describe Partner do
|
12
|
+
describe 'validations' do
|
13
|
+
it 'is not valid without a name' do
|
14
|
+
partner = Partner.new()
|
15
|
+
expect(partner.valid?).to be_falsey
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,429 @@
|
|
1
|
+
# The majority of the Supplejack API code is Crown copyright (C) 2014, New Zealand Government,
|
2
|
+
# and is licensed under the GNU General Public License, version 3.
|
3
|
+
# One component is a third party component. See https://github.com/DigitalNZ/supplejack_api for details.
|
4
|
+
#
|
5
|
+
# Supplejack was created by DigitalNZ at the National Library of NZ and
|
6
|
+
# the Department of Internal Affairs. http://digitalnz.org/supplejack
|
7
|
+
|
8
|
+
require 'spec_helper'
|
9
|
+
|
10
|
+
module SupplejackApi
|
11
|
+
describe RecordSearch do
|
12
|
+
before(:each) do
|
13
|
+
@search = RecordSearch.new
|
14
|
+
Sunspot.session = SunspotMatchers::SunspotSessionSpy.new(Sunspot.session)
|
15
|
+
@session = Sunspot.session
|
16
|
+
|
17
|
+
allow(RecordSearch).to receive(:role_collection_restrictions) { [] }
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '.role_collection_restrictions' do
|
21
|
+
let(:developer) { double(:scope, role: 'developer') }
|
22
|
+
let(:admin) { double(:scope, role: 'admin') }
|
23
|
+
let(:developer_restriction) { double(:developer_restriction, record_restrictions: {is_restricted: true}) }
|
24
|
+
let(:no_restriction) { double(:no_restriction, record_restrictions: nil) }
|
25
|
+
|
26
|
+
before(:each) do
|
27
|
+
allow(RecordSearch).to receive(:role_collection_restrictions).and_call_original
|
28
|
+
allow(RecordSchema).to receive(:roles) { {admin: no_restriction, developer: developer_restriction} }
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should handle nil scope' do
|
32
|
+
expect(RecordSearch.role_collection_restrictions(nil)).to eq []
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should return nil when no role restrictions are defined in the Schema' do
|
36
|
+
expect(RecordSearch.role_collection_restrictions(admin)).to eq []
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should return nil when no role restrictions are defined in the Schema' do
|
40
|
+
expect(RecordSearch.role_collection_restrictions(developer)).to eq({is_restricted: true})
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def query_fields_for_search
|
45
|
+
@session.searches.last.last.instance_variable_get(:@query).to_params[:qf]
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '#execute_solr_search' do
|
49
|
+
context 'solr errors' do
|
50
|
+
before do
|
51
|
+
@sunspot_builder = double(:sunspot_builder).as_null_object
|
52
|
+
allow(@search).to receive(:search_builder) { @sunspot_builder }
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'rescues from a bad request error' do
|
56
|
+
allow(@sunspot_builder).to receive(:execute).and_raise(RSolr::Error::Http.new({}, {}))
|
57
|
+
@search.execute_solr_search
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'adds a error message for a Solr request error' do
|
61
|
+
allow(@sunspot_builder).to receive(:execute).and_raise(RSolr::Error::Http.new({}, {}))
|
62
|
+
allow(@search).to receive(:solr_error_message) { 'Problem!' }
|
63
|
+
@search.execute_solr_search
|
64
|
+
expect(@search.errors.first).to eq 'Problem!'
|
65
|
+
end
|
66
|
+
|
67
|
+
[Timeout::Error, Errno::ECONNREFUSED, Errno::ECONNRESET].each do |error_klass|
|
68
|
+
it 'adds a error message for a #{Timeout::Error} error' do
|
69
|
+
allow(@sunspot_builder).to receive(:execute).and_raise(error_klass)
|
70
|
+
expect(@search.execute_solr_search).to eq({})
|
71
|
+
expect(@search.errors.first).to eq 'Solr is temporarily unavailable please try again in a few seconds.'
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'should call keywords method with user input' do
|
77
|
+
@search.options[:text] = 'dog'
|
78
|
+
@search.execute_solr_search
|
79
|
+
expect(@session).to have_search_params(:keywords, 'dog')
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'downcases the user entered text' do
|
83
|
+
@search.options[:text] = 'Dog'
|
84
|
+
@search.execute_solr_search
|
85
|
+
expect(@session).to have_search_params(:keywords, 'dog')
|
86
|
+
end
|
87
|
+
|
88
|
+
it "doesn't downcase SOLR operators" do
|
89
|
+
@search.options[:text] = 'dog NOT beach'
|
90
|
+
@search.execute_solr_search
|
91
|
+
expect(@session).to have_search_params(:keywords, 'dog NOT beach')
|
92
|
+
end
|
93
|
+
|
94
|
+
it "doesn't upcase words containing solr operators" do
|
95
|
+
@search.options[:text] = 'New Zealand'
|
96
|
+
@search.execute_solr_search
|
97
|
+
expect(@session).to have_search_params(:keywords, 'new zealand')
|
98
|
+
end
|
99
|
+
|
100
|
+
it "doesn't downcase when targeting a specific field" do
|
101
|
+
@search.options[:text] = "name_sm:\"John Doe\""
|
102
|
+
@search.execute_solr_search
|
103
|
+
expect(@session).to have_search_params(:keywords, "name_sm:\"John Doe\"")
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'restricts the query fields to name' do
|
107
|
+
@search.options[:text] = 'dog'
|
108
|
+
@search.options[:query_fields] = [:name]
|
109
|
+
@search.execute_solr_search
|
110
|
+
expect(query_fields_for_search.split(' ').sort).to eq ['name_text']
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'restricts to multiple query fields' do
|
114
|
+
@search.options[:text] = 'dog'
|
115
|
+
@search.options[:query_fields] = [:name, :address]
|
116
|
+
@search.execute_solr_search
|
117
|
+
expect(query_fields_for_search.split(' ').sort).to eq ['address_text', 'name_text']
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'should search for all text fields' do
|
121
|
+
@search.options[:text] = 'dog'
|
122
|
+
@search.execute_solr_search
|
123
|
+
expect(query_fields_for_search.split(' ').sort).to include('address_text', 'name_text')
|
124
|
+
end
|
125
|
+
|
126
|
+
it "should not use the query fields if text isn't present" do
|
127
|
+
@search.options[:query_fields] = [:name, :address]
|
128
|
+
@search.execute_solr_search
|
129
|
+
expect(query_fields_for_search).to be_nil
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'should add any facets in the :facets parameter' do
|
133
|
+
@search.options[:facets] = 'name, address'
|
134
|
+
@search.execute_solr_search
|
135
|
+
expect(@session).to have_search_params(:facet, :name)
|
136
|
+
expect(@session).to have_search_params(:facet, :address)
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'should limit the amount of facet values' do
|
140
|
+
@search.options.merge!(facets: 'name', facets_per_page: 10)
|
141
|
+
@search.execute_solr_search
|
142
|
+
expect(@session).to have_search_params(:facet, Proc.new {
|
143
|
+
facet(:name, :limit => 10)
|
144
|
+
})
|
145
|
+
end
|
146
|
+
|
147
|
+
it 'should offset the facets returned' do
|
148
|
+
@search.options.merge!(facets: 'name', facets_per_page: 10, facets_page: 2)
|
149
|
+
@search.execute_solr_search
|
150
|
+
expect(@session).to have_search_params(:facet, Proc.new {
|
151
|
+
facet(:name, :offset => 10)
|
152
|
+
})
|
153
|
+
end
|
154
|
+
|
155
|
+
it 'should restrict results by facet values' do
|
156
|
+
@search.options[:and] = {address: 'Wellington'}
|
157
|
+
@search.execute_solr_search
|
158
|
+
expect(@session).to have_search_params(:with, :address, 'Wellington')
|
159
|
+
end
|
160
|
+
|
161
|
+
it 'should restrict results by multiple facet values' do
|
162
|
+
@search.options[:and] = {name: 'John Doe', address: 'Wellington'}
|
163
|
+
@search.execute_solr_search
|
164
|
+
expect(@session).to have_search_params(:with, Proc.new {
|
165
|
+
all_of do
|
166
|
+
with(:name, 'John Doe')
|
167
|
+
with(:address, 'Wellington')
|
168
|
+
end
|
169
|
+
})
|
170
|
+
end
|
171
|
+
|
172
|
+
it 'should preserve commas in facet values' do
|
173
|
+
@search.options[:and] = {address: '12 Smith St, Te Aro, Wellington'}
|
174
|
+
@search.execute_solr_search
|
175
|
+
expect(@session).to have_search_params(:with, Proc.new {
|
176
|
+
all_of do
|
177
|
+
with(:address, '12 Smith St, Te Aro, Wellington')
|
178
|
+
end
|
179
|
+
})
|
180
|
+
end
|
181
|
+
|
182
|
+
it 'should restrict result by multiple facet values if an array is passed' do
|
183
|
+
@search.options[:and] = {email: ['jd@example.com', 'johnd@test.com']}
|
184
|
+
@search.execute_solr_search
|
185
|
+
expect(@session).to have_search_params(:with, Proc.new {
|
186
|
+
with(:email).all_of(['jd@example.com', 'johnd@test.com'])
|
187
|
+
})
|
188
|
+
end
|
189
|
+
|
190
|
+
it 'converts the string true to a real true' do
|
191
|
+
@search.options[:and] = {nz_citizen: 'true'}
|
192
|
+
@search.execute_solr_search
|
193
|
+
expect(@session).to have_search_params(:with, :nz_citizen, true)
|
194
|
+
end
|
195
|
+
|
196
|
+
it 'converts the string false to a real false' do
|
197
|
+
@search.options[:and] = {nz_citizen: 'false'}
|
198
|
+
@search.execute_solr_search
|
199
|
+
expect(@session).to have_search_params(:with, :nz_citizen, false)
|
200
|
+
end
|
201
|
+
|
202
|
+
it 'executes a prefix query when a star(*) is at the end of the value' do
|
203
|
+
@search.options[:and] = {name: 'John*'}
|
204
|
+
@search.execute_solr_search
|
205
|
+
expect(@session).to have_search_params(:with, Proc.new {
|
206
|
+
with(:name).starting_with('John')
|
207
|
+
})
|
208
|
+
end
|
209
|
+
|
210
|
+
it 'ignores a prefix query if the star(*) is not at the end' do
|
211
|
+
@search.options[:and] = {name: '*John'}
|
212
|
+
@search.execute_solr_search
|
213
|
+
expect(@session).to have_search_params(:with, :name, '*John')
|
214
|
+
end
|
215
|
+
|
216
|
+
it 'should return results matching any of the facet values' do
|
217
|
+
@search.options[:or] = {email: ['jd@example.com', 'johnd@test.com'], name: 'James Cook'}
|
218
|
+
@search.execute_solr_search
|
219
|
+
expect(@session).to have_search_params(:with, Proc.new {
|
220
|
+
any_of do
|
221
|
+
with(:email).any_of(['jd@example.com', 'johnd@test.com'])
|
222
|
+
with(:name, 'James Cook')
|
223
|
+
end
|
224
|
+
})
|
225
|
+
end
|
226
|
+
|
227
|
+
it 'should not return results matching the facet values' do
|
228
|
+
@search.options[:without] = {email: 'jd@example.com, johnd@test.com', name: 'James Cook'}
|
229
|
+
@search.execute_solr_search
|
230
|
+
expect(@session).to have_search_params(:without, Proc.new {
|
231
|
+
without(:email, 'jd@example.com')
|
232
|
+
without(:email, 'johnd@test.com')
|
233
|
+
without(:name, 'James Cook')
|
234
|
+
})
|
235
|
+
end
|
236
|
+
|
237
|
+
it 'should return results with any value' do
|
238
|
+
@search.options[:without] = {address: 'nil'}
|
239
|
+
@search.execute_solr_search
|
240
|
+
expect(@session).to have_search_params(:without, :address, nil)
|
241
|
+
end
|
242
|
+
|
243
|
+
# it 'should return results with locations with in the co ordinate range' do
|
244
|
+
# @search.options[:geo_bbox] = "-28.729130483430154,159.169921875,-52.025458603488126,-169.716796875"
|
245
|
+
# @search.execute_solr_search
|
246
|
+
# @session).to have_search_params(:without, Proc.new {
|
247
|
+
# without(:email, 'jd@example.com')
|
248
|
+
# without(:email, 'johnd@test.com')
|
249
|
+
# without(:name, 'James Cook')
|
250
|
+
# end
|
251
|
+
|
252
|
+
it 'should sort by the specified field' do
|
253
|
+
@search.options[:sort] = 'name'
|
254
|
+
@search.execute_solr_search
|
255
|
+
expect(@session).to have_search_params(:order_by, :name, :desc)
|
256
|
+
end
|
257
|
+
|
258
|
+
it 'should not sort when not specified' do
|
259
|
+
@search.options[:sort] = ''
|
260
|
+
@search.execute_solr_search
|
261
|
+
expect(@session).to_not have_search_params(:order_by, any_param)
|
262
|
+
end
|
263
|
+
|
264
|
+
it 'should default to page 1 and 20 per page' do
|
265
|
+
@search.execute_solr_search
|
266
|
+
expect(@session).to have_search_params(:paginate, page: 1, per_page: 20)
|
267
|
+
end
|
268
|
+
|
269
|
+
it 'should change the page and per_page defaults' do
|
270
|
+
@search.options.merge!(page: 3, per_page: 40)
|
271
|
+
@search.execute_solr_search
|
272
|
+
expect(@session).to have_search_params(:paginate, page: 3, per_page: 40)
|
273
|
+
end
|
274
|
+
|
275
|
+
it 'removes records from the search based on role restrictions' do
|
276
|
+
allow(RecordSearch).to receive(:role_collection_restrictions) { {nz_citizen: true} }
|
277
|
+
|
278
|
+
@search.execute_solr_search
|
279
|
+
expect(@session).to have_search_params(:without, :nz_citizen, true)
|
280
|
+
end
|
281
|
+
|
282
|
+
it 'removes records from the search based on multiple restrictions per role' do
|
283
|
+
allow(RecordSearch).to receive(:role_collection_restrictions) { {email: ['jd@example.com', 'johnd@test.com']} }
|
284
|
+
|
285
|
+
@search.execute_solr_search
|
286
|
+
expect(@session).to have_search_params(:without, :email, ['jd@example.com', 'johnd@test.com'])
|
287
|
+
end
|
288
|
+
|
289
|
+
it 'should add the lucene string to the solr :q.alt parameter' do
|
290
|
+
@search.options.merge!(solr_query: 'title:dogs')
|
291
|
+
@search.execute_solr_search
|
292
|
+
|
293
|
+
alt = @session.searches.last.last.instance_variable_get(:@query).to_params['q.alt']
|
294
|
+
expect(alt).to eq('title:dogs')
|
295
|
+
end
|
296
|
+
|
297
|
+
it 'should add spellcheck if suggest parameter is true' do
|
298
|
+
@search.options.merge!(suggest: true)
|
299
|
+
@search.execute_solr_search
|
300
|
+
expect(@session.searches.last.last.instance_variable_get(:@query).to_params[:spellcheck]).to be_truthy
|
301
|
+
expect(@session.searches.last.last.instance_variable_get(:@query).to_params['spellcheck.collate']).to be_truthy
|
302
|
+
expect(@session.searches.last.last.instance_variable_get(:@query).to_params['spellcheck.onlyMorePopular']).to be_truthy
|
303
|
+
end
|
304
|
+
|
305
|
+
context 'nested queries' do
|
306
|
+
it 'joins name values with a OR query' do
|
307
|
+
@search.options[:and] = {name: {or: ['John', 'James']}}
|
308
|
+
@search.execute_solr_search
|
309
|
+
expect(@session).to have_search_params(:with, Proc.new {
|
310
|
+
with(:name).any_of(['John', 'James'])
|
311
|
+
})
|
312
|
+
end
|
313
|
+
|
314
|
+
it 'joins two facets with OR but values within each filter with AND' do
|
315
|
+
@search.options[:or] = {name: {and: ['John', 'James']}, address: {and: ['Wellington', 'Auckland']} }
|
316
|
+
@search.execute_solr_search
|
317
|
+
expect(@session).to have_search_params(:with, Proc.new {
|
318
|
+
any_of do
|
319
|
+
with(:name).all_of(['John', 'James'])
|
320
|
+
with(:address).all_of(['Wellington', 'Auckland'])
|
321
|
+
end
|
322
|
+
})
|
323
|
+
end
|
324
|
+
|
325
|
+
it 'joins two AND conditions with OR, one AND condition contains multiple fields' do
|
326
|
+
@search.options[:or] = {name: {and: ['John', 'James']}, and: {address: 'Wellington', nz_citizen: 'true'} }
|
327
|
+
@search.execute_solr_search
|
328
|
+
expect(@session).to have_search_params(:with, Proc.new {
|
329
|
+
any_of do
|
330
|
+
with(:name).all_of(['John', 'James'])
|
331
|
+
all_of do
|
332
|
+
with(:address, 'Wellington')
|
333
|
+
with(:nz_citizen, 'true')
|
334
|
+
end
|
335
|
+
end
|
336
|
+
})
|
337
|
+
end
|
338
|
+
|
339
|
+
it 'nesting OR and AND conditions 3 levels deep' do
|
340
|
+
@search.options[:and] = {name: 'John', or: {address: 'Wellington', and: {nz_citizen: 'true', email: 'john@test.com'}}}
|
341
|
+
@search.execute_solr_search
|
342
|
+
expect(@session).to have_search_params(:with, Proc.new {
|
343
|
+
all_of do
|
344
|
+
with(:name, 'John')
|
345
|
+
any_of do
|
346
|
+
with(:address, 'Wellington')
|
347
|
+
all_of do
|
348
|
+
with(:nz_citizen, 'true')
|
349
|
+
with(:email, 'john@test.com')
|
350
|
+
end
|
351
|
+
end
|
352
|
+
end
|
353
|
+
})
|
354
|
+
end
|
355
|
+
|
356
|
+
it 'joins options[:and] and options[:or] conditions with AND' do
|
357
|
+
@search.options[:and] = {name: {or: ['John', 'James']}, nz_citizen: 'true'}
|
358
|
+
@search.options[:or] = {address: ['Wellington', 'Auckland']}
|
359
|
+
@search.execute_solr_search
|
360
|
+
expect(@session).to have_search_params(:with, Proc.new {
|
361
|
+
all_of do
|
362
|
+
all_of do
|
363
|
+
with(:name).any_of(['John', 'James'])
|
364
|
+
with(:nz_citizen, 'true')
|
365
|
+
end
|
366
|
+
with(:address).any_of(['Wellington', 'Auckland'])
|
367
|
+
end
|
368
|
+
})
|
369
|
+
end
|
370
|
+
|
371
|
+
it 'nests multiple filters with :or queries in their values' do
|
372
|
+
@search.options[:and] = {name: {or: ['John', 'James']}, nz_citizen: 'true', address: {or: ['Wellington', 'Auckland']}}
|
373
|
+
@search.execute_solr_search
|
374
|
+
expect(@session).to have_search_params(:with, Proc.new {
|
375
|
+
all_of do
|
376
|
+
with(:name).any_of(['John', 'James'])
|
377
|
+
with(:nz_citizen, 'true')
|
378
|
+
with(:address).any_of(['Wellington', 'Auckland'])
|
379
|
+
end
|
380
|
+
})
|
381
|
+
end
|
382
|
+
end
|
383
|
+
|
384
|
+
context 'facet queries' do
|
385
|
+
def facet_query_params
|
386
|
+
@session.searches.last.last.instance_variable_get(:@query).to_params[:'facet.query']
|
387
|
+
end
|
388
|
+
|
389
|
+
it 'queries for all of given facet' do
|
390
|
+
@search.options.merge!({facet_query: {email: {email: 'all'}}})
|
391
|
+
@search.execute_solr_search
|
392
|
+
expect(facet_query_params).to eq('email_sm:[* TO *]')
|
393
|
+
end
|
394
|
+
|
395
|
+
it 'queries for records with name "John"' do
|
396
|
+
@search.options.merge!({facet_query: {people: {'name' => 'John'}}})
|
397
|
+
@search.execute_solr_search
|
398
|
+
expect(facet_query_params).to eq('name_s:John')
|
399
|
+
end
|
400
|
+
|
401
|
+
it 'queries for records without name "James"' do
|
402
|
+
@search.options.merge!({facet_query: {people: {'-name' => 'James'}}})
|
403
|
+
@search.execute_solr_search
|
404
|
+
expect(facet_query_params).to eq('-name_s:James')
|
405
|
+
end
|
406
|
+
|
407
|
+
it 'correctly reads a "false" value' do
|
408
|
+
@search.options.merge!({facet_query: {citizens: {'nz_citizen' => 'false'}}})
|
409
|
+
@search.execute_solr_search
|
410
|
+
expect(facet_query_params).to eq('nz_citizen_b:false')
|
411
|
+
end
|
412
|
+
|
413
|
+
it 'queries for records with category Images and Videos' do
|
414
|
+
@search.options.merge!({facet_query: {people: {'name' => ['John', 'James']}}})
|
415
|
+
@search.execute_solr_search
|
416
|
+
expect(facet_query_params).to eq('name_s:(John AND James)')
|
417
|
+
end
|
418
|
+
end
|
419
|
+
|
420
|
+
it 'removes blacklisted collections from results' do
|
421
|
+
FactoryGirl.create(:source, source_id: 'DNZ', status: 'suppressed' )
|
422
|
+
@search.execute_solr_search
|
423
|
+
expect(@session).to have_search_params(:without, :source_id, 'DNZ')
|
424
|
+
end
|
425
|
+
end
|
426
|
+
|
427
|
+
end
|
428
|
+
|
429
|
+
end
|