Thanks, Steven!

Is the 'identifier_for_search_result' method (below) the drop in replacement for the now-removed 'show_identifier_column' method?

Mark

<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Mark Cyzyk, M.A., M.L.S.
Library Applications Group
The Sheridan Libraries
The Johns Hopkins University
mcy...@jhu.edu

Verba volant, scripta manent.

On 9/14/20 4:36 PM, Majewski, Steven Dennis (sdm7g) wrote:
Looks like the docs must have slipped behind the changes.

git log -p frontend/app/helpers/search_helper.rb

Shows that function removed, I assume as part of the many search changes in v2.8.0


*diff --git a/frontend/app/helpers/search_helper.rb b/frontend/app/helpers/search_helper.rb*
*index a192965ee..c5a371cc0 100644*
*--- a/frontend/app/helpers/search_helper.rb*
*+++ b/frontend/app/helpers/search_helper.rb*
@@ -18,12 +18,32 @@module SearchHelper
  "subject"                  => "authority_id",
}


+ def identifier_for_search_result(result)
+   identifier = IDENTIFIER_FOR_SEARCH_RESULT_LOOKUP.fetch(result["primary_type"], "")
+   unless identifier.empty?
+     if result.has_key? identifier
+       identifier = result[identifier]
+     else
+       json       = ASUtils.json_parse(result["json"])
+       identifier = json.fetch(identifier, "")
+     end
+   end
+   identifier.to_s.html_safe
+ end
+
def build_search_params(opts = {})
+
+   removing_record_type_filter = false
+   Array(opts["remove_filter_term"]).each do |filter_term|
+     removing_record_type_filter = true if ASUtils.json_parse(filter_term).keys.include? 'primary_type'
+   end
+
  search_params = {}


  search_params["filter_term"] = Array(opts["filter_term"] || params["filter_term"]).clone search_params["filter_term"].concat(Array(opts["add_filter_term"])) if opts["add_filter_term"]   search_params["filter_term"] = search_params["filter_term"].reject{|f| Array(opts["remove_filter_term"]).include?(f)} if opts["remove_filter_term"] +   search_params["filter_term"] = search_params["filter_term"].select{|f| SearchResultData.BASE_FACETS.include?(ASUtils.json_parse(f).keys.first)} if removing_record_type_filter


  if params["multiplicity"]
    search_params["multiplicity"] = params["multiplicity"]
@@ -31,19 +51,12 @@module SearchHelper


  sort = (opts["sort"] || params["sort"])


-    if show_identifier_column?
- search_params["display_identifier"] = true
-    end
-
-    # if the browse list was sorted by default
-    if sort.nil? && !@search_data.nil? && @search_data.sorted?
-      sort = @search_data[:criteria]["sort"]
-    end
-
  if sort
    sort = sort.split(', ')
    sort[1] = opts["sort2"] if opts["sort2"]
-      search_params["sort"] = sort.uniq.join(', ')
+     fields = sort.uniq
+     fields = fields.select {|f| multi_columns.compact.include?(f.split.first)} if removing_record_type_filter
+     search_params["sort"] = fields.join(', ')
  end


  if (opts["format"] || params["format"]).blank?





On Sep 14, 2020, at 4:05 PM, Mark Cyzyk <mcy...@jhu.edu <mailto:mcy...@jhu.edu>> wrote:


Dear Aspace List,

Here is a puzzler:

One of our custom plugins is throwing an error with ASpace 2.8.0:

I, [2020-09-14T18:31:21.347591 #1711]  INFO -- :   Rendered shared/_breadcrumb.html.erb (3729.1ms) I, [2020-09-14T18:31:21.551547 #1711]  INFO -- : Rendered search/_filter.html.erb (187.7ms) I, [2020-09-14T18:31:23.178717 #1711]  INFO -- : Rendered /usr/share/archivesspace/plugins/staff_mode_search/frontend/views/search/_listing.html.erb (1380.8ms) I, [2020-09-14T18:31:23.188677 #1711]  INFO -- : Rendered search/_results.html.erb (1834.8ms) I, [2020-09-14T18:31:23.191373 #1711]  INFO -- : Rendered search/do_search.html.erb within layouts/application (5600.4ms) I, [2020-09-14T18:31:23.193788 #1711]  INFO -- : Completed 500 Internal Server Error in 8777ms
F, [2020-09-14T18:31:23.238453 #1711] FATAL -- :
F, [2020-09-14T18:31:23.238827 #1711] FATAL -- : ActionView::Template::Error (undefined method `show_identifier_column?' for #<#<Class:0x36821e2c>:0x5ccfe41e>
Did you mean?  show_external_ids?):
F, [2020-09-14T18:31:23.251369 #1711] FATAL -- :      6: %>
     7:
     8: <% if @search_data.results? %>
     9:   <% add_identifier_column if show_identifier_column? %>
    10:   <%= render_aspace_partial :partial => "shared/pagination_summary" %>
    11:
    12:   <table id="tabledSearchResults" class="table table-striped table-bordered table-condensed table-hover table-sortable table-search-results" <% if allow_multi_select? %>data-multiselect="true"<% end %>>
F, [2020-09-14T18:31:23.251910 #1711] FATAL -- :
F, [2020-09-14T18:31:23.252256 #1711] FATAL -- : app/helpers/application_helper.rb:307:in `render_aspace_partial' app/views/search/_results.html.erb:22:in `_app_views_search__results_html_erb___900220805_2354'
app/helpers/application_helper.rb:307:in `render_aspace_partial'
app/views/search/do_search.html.erb:16:in `_app_views_search_do_search_html_erb___1615232398_2350

The key line here is, I think:

F, [2020-09-14T18:31:23.238827 #1711] FATAL -- : ActionView::Template::Error (undefined method `show_identifier_column?' for #<#<Class:0x36821e2c>:0x5ccfe41e>
Did you mean?  show_external_ids?):

No, I didn't mean "show_external_ids'!

The docs do indeed list 'show_identifier_column?' as a method. (/archivesspace/docs/doc/SearchHelper.html#show_identifier_column%3F-instance_method)

Does anyone have an idea about why ASpace 2.8.0 might be throwing this error when this method is called?

Much appreciated,

Mark

--
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Mark Cyzyk, M.A., M.L.S.
Library Applications Group
The Sheridan Libraries
The Johns Hopkins University
mcy...@jhu.edu <mailto:mcy...@jhu.edu>

Verba volant, scripta manent.

_______________________________________________
Archivesspace_Users_Group mailing list
Archivesspace_Users_Group@lyralists.lyrasis.org
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group


_______________________________________________
Archivesspace_Users_Group mailing list
Archivesspace_Users_Group@lyralists.lyrasis.org
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group

Reply via email to