<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div class=""><br class="">
</div>
<div class="">@scheme is re-used later in the importer to construct the URI for the marc.xml, as well as in the search, so instead of adding the prefix to @scheme, it should just be prefixed in the search parameters: </div>
<div class=""><br class="">
</div>
<div class="">
<div style="margin: 0px; font-size: 16px; line-height: normal; color: rgb(176, 36, 18); background-color: rgb(255, 206, 182);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">-    params = default_params.merge('q' => [query.to_s, @scheme],</span></div>
<div style="margin: 0px; font-size: 16px; line-height: normal; color: rgb(0, 164, 0); background-color: rgb(255, 206, 182);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">+    params = default_params.merge('q' => [query.to_s, 'cs:' + @scheme],</span></div>
</div>
<div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class="">
</span></div>
<div class="">Sorry for the quick & wrong first answer! </div>
<div class=""><br class="">
</div>
<div class="">— Steve. </div>
<div class=""><br class="">
</div>
<br class="">
<div>
<blockquote type="cite" class="">
<div class="">On Jun 16, 2017, at 4:03 PM, Majewski, Steven Dennis (sdm7g) <<a href="mailto:sdm7g@eservices.virginia.edu" class="">sdm7g@eservices.virginia.edu</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div class=""><br class="">
</div>
<div class="">Although those changes seem to fix the search, when I actually try importing either subject or agent records, I get an internal server error. This need more investigation.  </div>
<div class=""><br class="">
</div>
<br class="">
<div class="">
<blockquote type="cite" class="">
<div class="">On Jun 16, 2017, at 3:12 PM, Majewski, Steven Dennis (sdm7g) <<a href="mailto:sdm7g@eservices.virginia.edu" class="">sdm7g@eservices.virginia.edu</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div class=""><br class="">
</div>
<div class="">My tests and patch were on current master branch, and so it looks like there were further changes to lcnaf between 1.4.2 and 2.0.1 . </div>
<div class=""><br class="">
</div>
<div class="">But the significant changes in my patch were: </div>
<div class=""><br class="">
</div>
<div class="">[1] prefixing the @scheme parameter with (what I assume is) a field specifier:  @scheme =  “cs:”  + @scheme</div>
<div class="">( prefix could either be added to @scheme in initialized method, or else added to the search params in search method. ) You can just manually edit that change if the patch doesn’t work. </div>
<div class=""><br class="">
</div>
<div class="">[2] the “p uri” prints out the final <a href="http://doc.gov/" class="">
doc.gov</a> URI and query string. This was part of the debugging and reverse engineering: to compare the URI & query in
<a href="http://id.loc.gov/" class="">id.loc.gov</a> search page with what LCNAF plugin was using. Since I’m not sure if API changes to
<a href="http://id.loc.gov/" class="">id.loc.gov</a> are documented anywhere, I left it there in case of future changes or problems. You can always grab the URL out of the log file and paste it into curl or your browser to see if it’s working as expected. So
 the line 71 change is not required. </div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">— Steve. </div>
<div class=""><br class="">
</div>
<br class="">
<div class="">
<blockquote type="cite" class="">
<div class="">On Jun 16, 2017, at 2:38 PM, Maurice, Candace A <<a href="mailto:cmaurice@tulane.edu" class="">cmaurice@tulane.edu</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 14px; font-family: Calibri, sans-serif;" class="">
<div class="">Hi Steve, </div>
<div class=""><br class="">
</div>
<div class="">I tried to implement the patch, but still no luck. My file on line 71 is different than in the patch you provided  (see function below).</div>
<div class=""><br class="">
</div>
<div class="">def search(query, page, records_per_page)</div>
<div class="">
<div class="">    uri = URI(@base_url)</div>
<div class="">    start_record = calculate_start_record(page, records_per_page)</div>
<div class="">    params = default_params.merge('q' => [query.to_s, @scheme],</div>
<div class="">                                  'count' => records_per_page,</div>
<div class="">                                  'start' => start_record)</div>
<div class=""><br class="">
</div>
<div class="">    uri.query = URI.encode_www_form(params)</div>
<div class=""><br class="">
</div>
<div class="">    response = Net::HTTP.get_response(uri)</div>
<div class=""><br class="">
</div>
<div class="">    if response.code != '200'</div>
<div class="">      raise OpenSearchException.new("Error during OpenSearch search: #{response.body}")</div>
<div class="">    end</div>
<div class=""><br class="">
</div>
<div class="">    results = OpenSearchResultSet.new(response.body, query)</div>
<div class=""><br class="">
</div>
<div class="">    results.entries.each do |entry|</div>
<div class="">      marc_uri = URI("#{entry['uri']}.marcxml.xml")</div>
<div class="">      response = Net::HTTP.get_response(marc_uri)</div>
<div class="">      if response.code != '200'</div>
<div class="">        raise OpenSearchException.new("Error during OpenSearch search: #{response.body}")</div>
<div class="">      end</div>
<div class=""><br class="">
</div>
<div class="">      entry['xml'] = response.body.force_encoding("iso-8859-1").encode('utf-8')</div>
<div class="">    end</div>
<div class=""><br class="">
</div>
<div class="">    results</div>
<div class="">  End</div>
</div>
<div class=""><br class="">
</div>
<div class="">-candace</div>
<div class=""><br class="">
</div>
<span id="OLK_SRC_BODY_SECTION" class="">
<div style="font-family: Calibri; font-size: 11pt; text-align: left; border-width: 1pt medium medium; border-style: solid none none; padding: 3pt 0in 0in; border-top-color: rgb(181, 196, 223);" class="">
<span style="font-weight:bold" class="">From: </span><<a href="mailto:archivesspace_users_group-bounces@lyralists.lyrasis.org" class="">archivesspace_users_group-bounces@lyralists.lyrasis.org</a>> on behalf of "Majewski, Steven Dennis (sdm7g)" <<a href="mailto:sdm7g@eservices.virginia.edu" class="">sdm7g@eservices.virginia.edu</a>><br class="">
<span style="font-weight:bold" class="">Reply-To: </span>Archivesspace Users Group <<a href="mailto:archivesspace_users_group@lyralists.lyrasis.org" class="">archivesspace_users_group@lyralists.lyrasis.org</a>><br class="">
<span style="font-weight:bold" class="">Date: </span>Thursday, June 15, 2017 at 12:26 PM<br class="">
<span style="font-weight:bold" class="">To: </span>Archivesspace Users Group <<a href="mailto:archivesspace_users_group@lyralists.lyrasis.org" class="">archivesspace_users_group@lyralists.lyrasis.org</a>><br class="">
<span style="font-weight:bold" class="">Subject: </span>Re: [Archivesspace_Users_Group] Subject Heading Plugin not working properly 1.4.2<br class="">
</div>
<div class=""><br class="">
</div>
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">It appears to be no longer working in any version. </div>
<div class="">I believe loc has changed the API for the service slightly. Need to investigate further.</div>
<div class="">But trying to reverse engineer the parameters from inspecting the difference in the params used in the web page search vs. what’s embedded in LCNAF plugin, I tried this change, which appears to work for me: </div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">
<div style="margin: 0px; line-height: normal; color: rgb(105, 40, 40); background-color: rgb(255, 238, 219);" class="">
<span style="font-variant-ligatures: no-common-ligatures;" class=""><b class=""><font size="2" class="">diff --git a/plugins/lcnaf/frontend/models/opensearcher.rb b/plugins/lcnaf/frontend/models/opensearcher.rb</font></b></span></div>
<div style="margin: 0px; line-height: normal; color: rgb(105, 40, 40); background-color: rgb(255, 238, 219);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class=""><b class=""><font size="2" class="">index 9391ab5..37e2813 100644</font></b></span></div>
<div style="margin: 0px; line-height: normal; color: rgb(105, 40, 40); background-color: rgb(255, 238, 219);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class=""><b class=""><font size="2" class="">--- a/plugins/lcnaf/frontend/models/opensearcher.rb</font></b></span></div>
<div style="margin: 0px; line-height: normal; color: rgb(105, 40, 40); background-color: rgb(255, 238, 219);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class=""><b class=""><font size="2" class="">+++ b/plugins/lcnaf/frontend/models/opensearcher.rb</font></b></span></div>
<div style="margin: 0px; line-height: normal; background-color: rgb(255, 238, 219);" class="">
<font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #24b1bf" class="">@@ -14,7 +14,7 @@</span><span style="font-variant-ligatures: no-common-ligatures" class=""> class OpenSearcher</span></font></div>
<div style="margin: 0px; line-height: normal; background-color: rgb(255, 238, 219); min-height: 19px;" class="">
<font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><br class="webkit-block-placeholder">
</font></div>
<div style="margin: 0px; line-height: normal; background-color: rgb(255, 238, 219);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">   def initialize(base_url, scheme )</font></span></div>
<div style="margin: 0px; line-height: normal; background-color: rgb(255, 238, 219);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">     @base_url = base_url</font></span></div>
<div style="margin: 0px; line-height: normal; color: rgb(188, 48, 28); background-color: rgb(255, 238, 219);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">-    @scheme = scheme</font></span></div>
<div style="margin: 0px; line-height: normal; color: rgb(38, 179, 26); background-color: rgb(255, 238, 219);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">+    @scheme = "cs:" + scheme</font></span></div>
<div style="margin: 0px; line-height: normal; background-color: rgb(255, 238, 219);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">   end</font></span></div>
<div style="margin: 0px; line-height: normal; background-color: rgb(255, 238, 219); min-height: 19px;" class="">
<font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><br class="webkit-block-placeholder">
</font></div>
<div style="margin: 0px; line-height: normal; background-color: rgb(255, 238, 219); min-height: 19px;" class="">
<font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><br class="webkit-block-placeholder">
</font></div>
<div style="margin: 0px; line-height: normal; background-color: rgb(255, 238, 219);" class="">
<font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #24b1bf" class="">@@ -71,7 +71,7 @@</span><span style="font-variant-ligatures: no-common-ligatures" class=""> class OpenSearcher</span></font></div>
<div style="margin: 0px; line-height: normal; background-color: rgb(255, 238, 219);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">                                   'start' => start_record)</font></span></div>
<div style="margin: 0px; line-height: normal; background-color: rgb(255, 238, 219); min-height: 19px;" class="">
<font size="2" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><br class="webkit-block-placeholder">
</font></div>
<div style="margin: 0px; line-height: normal; background-color: rgb(255, 238, 219);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">     uri.query = URI.encode_www_form(params)</font></span></div>
<div style="margin: 0px; line-height: normal; color: rgb(188, 48, 28); background-color: rgb(255, 238, 219);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">-</font></span></div>
<div style="margin: 0px; line-height: normal; color: rgb(38, 179, 26); background-color: rgb(255, 238, 219);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">+    p uri</font></span></div>
<div style="margin: 0px; line-height: normal; background-color: rgb(255, 238, 219);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">     results = HTTPRequest.new.get(uri) do |response|</font></span></div>
<div style="margin: 0px; line-height: normal; background-color: rgb(255, 238, 219);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">       if response.code != '200'</font></span></div>
<div style="margin: 0px; line-height: normal; background-color: rgb(255, 238, 219);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class=""><font size="2" class="">         raise OpenSearchException.new("Error during OpenSearch search: #{response.body}")</font></span></div>
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">( The other OCLC search has always been unreliable — it’s a test site and not a supported service. ) </div>
<div class=""><br class="">
</div>
<div class="">— Steve Majewski</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<br class="">
<div class="">
<blockquote type="cite" class="">
<div class="">On Jun 15, 2017, at 12:07 PM, Maurice, Candace A <<a href="mailto:cmaurice@tulane.edu" class="">cmaurice@tulane.edu</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 14px; font-family: Calibri, sans-serif;" class="">
<div class="">Hello All,</div>
<div class=""><br class="">
</div>
<div class="">We are on version 1.4.2 and we have had a user report that the subject heading plugin is not returning results for either LCNAF or LCSH (OCLC works, however). The user doesn’t receive any error messages when using the plugin,  but tried typing
 in known subject headings for the Library Of Congress and it’s still not returning results. I checked the  Background jobs and logs and there are not error messages. I also went to the LOC website and all appears to be fine when searching subject headings
 on their site. </div>
<div class=""><br class="">
</div>
<div class="">Has anyone else experienced a similar issue? Can you point me in the right direction for resolving this issue? </div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">Thanks, </div>
<div class=""><br class="">
</div>
<div class="">Candace </div>
<div class=""><br class="">
</div>
<div class="">
<div class="">
<div class="">
<div class="">------------------------- </div>
<div class="">Candace Maurice</div>
</div>
<div class="">Web Developer</div>
<div class="">Howard-Tiltion Memorial Library</div>
<div class="">Tulane University </div>
<div class="">504.314.7784</div>
<div class=""><a href="mailto:cmaurice@tulane.edu" class="">cmaurice@tulane.edu</a></div>
<div class=""><span id="cid:AEBAE6F4-D08D-494B-8411-340260C5F8B7" class=""><512DA1AA-B52D-4559-9B7E-FB77BCC5BB86.png></span></div>
</div>
</div>
</div>
_______________________________________________<br class="">
Archivesspace_Users_Group mailing list<br class="">
<a href="mailto:Archivesspace_Users_Group@lyralists.lyrasis.org" class="">Archivesspace_Users_Group@lyralists.lyrasis.org</a><br class="">
<a href="http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group" class="">http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group</a><br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</span></div>
_______________________________________________<br class="">
Archivesspace_Users_Group mailing list<br class="">
<a href="mailto:Archivesspace_Users_Group@lyralists.lyrasis.org" class="">Archivesspace_Users_Group@lyralists.lyrasis.org</a><br class="">
<a href="http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group" class="">http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group</a><br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
_______________________________________________<br class="">
Archivesspace_Users_Group mailing list<br class="">
<a href="mailto:Archivesspace_Users_Group@lyralists.lyrasis.org" class="">Archivesspace_Users_Group@lyralists.lyrasis.org</a><br class="">
<a href="http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group" class="">http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group</a><br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
_______________________________________________<br class="">
Archivesspace_Users_Group mailing list<br class="">
<a href="mailto:Archivesspace_Users_Group@lyralists.lyrasis.org" class="">Archivesspace_Users_Group@lyralists.lyrasis.org</a><br class="">
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group<br class="">
</div>
</blockquote>
</div>
<br class="">
</body>
</html>