From 337ad6d84835940ba1a54137d618dc7fb5535694 Mon Sep 17 00:00:00 2001 From: Jane Sandberg Date: Fri, 17 Mar 2017 15:07:05 -0700 Subject: [PATCH 1/2] Displaying series as a facet, closes #6 --- app/controllers/catalog_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/catalog_controller.rb b/app/controllers/catalog_controller.rb index de6b259..686ec76 100644 --- a/app/controllers/catalog_controller.rb +++ b/app/controllers/catalog_controller.rb @@ -98,6 +98,7 @@ class CatalogController < ApplicationController config.add_facet_field 'subject_era_facet', :label => 'Era of focus', :limit => true, :sort => 'count' config.add_facet_field 'subject_name_facet', :label => 'People and groups', :limit => true, :sort => 'count' config.add_facet_field 'genre_facet', :label => 'Genre', :limit => true, :sort => 'count' + config.add_facet_field 'series_facet', :label => 'Series', :limit => true, :sort => 'count' config.add_facet_field 'record_source_facet', :label => 'Source database', :limit => true =begin From e6ae8731392fbeaeac0db55aa04bfb356c17044d Mon Sep 17 00:00:00 2001 From: Jane Sandberg Date: Fri, 17 Mar 2017 15:44:25 -0700 Subject: [PATCH 2/2] tests and documentation for ArticleSearch model --- app/models/article_search.rb | 6 ++++++ test/models/article_search_test.rb | 10 +++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/models/article_search.rb b/app/models/article_search.rb index 1491c86..1bf2547 100644 --- a/app/models/article_search.rb +++ b/app/models/article_search.rb @@ -8,6 +8,12 @@ def enough_data_exists_in(record) return true end + # Create a new search object + # + # q: a query string + # page: a page number (can be an int or string) + # requested_facets: an array + # api_connection: and ApiConnection object or one of its descendants def initialize(q, page, requested_facets = [], api_connection) @q = q @page = page diff --git a/test/models/article_search_test.rb b/test/models/article_search_test.rb index f6f9308..598af8f 100644 --- a/test/models/article_search_test.rb +++ b/test/models/article_search_test.rb @@ -1,7 +1,11 @@ require 'test_helper' + class ArticleSearchTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end + + test "Article Search search_opts method returns an array" do + a = ArticleSearch.new 'soap opera', 3, [], nil + assert_instance_of Array, a.search_opts + end + end