<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F4E79;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hi Henry!<br>
<br>
So, good news! As long as you’re on a reasonably current version of ASpace, you can change order by primary type purely via configuration.<br>
<br>
The way you’d do it is by setting the bq param in AppConfig[:solr_params] – here’s what we’ve got in production right now (we’re setting q.op also, because we wanted the default search operator to be AND:<br>
<br>
AppConfig[:solr_params] = { "q.op" => "AND", "bq" => proc { "primary_type:resource^100 OR primary_type:accession^100 OR primary_type:subject^50 OR primary_type:agent_person^50 OR primary_type:agent_corporate_entity^30 OR primary_type:agent_family^30" }}<br>
<br>
To set it how you’d like it, you could take our BQ and adjust the values so that AOs > collections > etc., e.g.:<br>
<br>
AppConfig[:solr_params] = {“bq” => proc { “primary_type:archival_object^100 OR primary_type:resource^50” }<br>
<br>
This is assuming you don’t care about sort order for other types, but fill in however many you want and adjust boost increments (the number after ^) to suit.
<br>
<br>
For more info on how bq works, consult the docs for Solr’s dismax parser: <a href="https://lucene.apache.org/solr/guide/6_6/the-dismax-query-parser.html">
https://lucene.apache.org/solr/guide/6_6/the-dismax-query-parser.html</a><br>
<br>
Note that in Solr it’s normal to pass multiple bq parameters if you want to boost multiple things, but prior to  2.6.0, solr_params didn’t support it, so one “bq” with a query using OR is a workaround.<br>
<br>
If you’re on 2.6.0 or higher, you can do:<br>
<br>
AppConfig[:solr_params] = {“bq” => [ ‘primary_type:archival_object^100’, ‘primary_type:resource^50’]}<br>
<br>
which is technically “cleaner” by solr standards, but is equivalent in function as far as I can tell.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">--<o:p></o:p></p>
<p class="MsoNormal">Dave Mayo (he/him)<o:p></o:p></p>
</div>
<p class="MsoNormal">Senior Digital Library Software Engineer<br>
Harvard University > HUIT > LTS<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black"><archivesspace_users_group-bounces@lyralists.lyrasis.org> on behalf of "Steele, Henry" <Henry.Steele@tufts.edu><br>
<b>Reply-To: </b>Archivesspace Users Group <archivesspace_users_group@lyralists.lyrasis.org><br>
<b>Date: </b>Tuesday, January 7, 2020 at 5:08 PM<br>
<b>To: </b>Archivesspace Users Group <archivesspace_users_group@lyralists.lyrasis.org><br>
<b>Subject: </b>[Archivesspace_Users_Group] question about customizing search features in the ArchivesSpace PUI<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal"><span style="color:#1F4E79">Good afternoon,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F4E79"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F4E79">I work at Tufts University in cooperation with the Digital Collections & Archives.   I am working on various changes to the public user interface.  Many of you helped with questions before, which were a great
 help!</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F4E79"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F4E79">There’s a change we want to make to search results.   I suspect it may involve getting into controllers and the functioning of ASpace, but I wanted to check, and ask if anyone has a plugin that does this sort
 of thing.  </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F4E79"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F4E79">We want to change the sort options for search results so that archival objects appear at the top, then collections, then everything else.  So by json_modeltype, with two of the highest precedence.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F4E79"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F4E79">I thought of doing this in jquery, but this wouldn’t work because that would only sort the results on the page.  
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F4E79"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F4E79">This may require development, but I wondered if someone had a direction to point me in, or if they had a plugin that could be modified. 
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F4E79"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F4E79">Thanks</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F4E79"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F4E79">Henry Steele</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F4E79">Systems Librarian</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F4E79">Tufts University Library Technology Services</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F4E79">(617)627-5239</span><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</body>
</html>