[Archivesspace_Users_Group] question about customizing search features in the ArchivesSpace PUI

Andrew Morrison andrew.morrison at bodleian.ox.ac.uk
Thu Jan 9 05:21:23 EST 2020

Some additional notes on relevance-rank boosting:

  *   When experimenting with different boost values, you have to restart after each change to config.rb (just the backend in a developer system, but in a system running a pre-built release you have to restart the whole thing, which gets tiresome).
  *   If you know how to access the Solr web interface (how depends on your setup) then it is quicker to play around with different boosts using that, before copying them into the ArchivesSpace config for final testing. To approximately simulate a simple keyword search in the public user interface, for example searching all records for the keyword "cheese", set q to fullrecord:cheese, set fq to types:pui, set fl to primary_type,title, select edismax, then enter your boosts in the bf field.
  *   bq can be space-separated instead of using OR.
  *   If you literally want any search query to return all archival objects first, even ones that only match the keyword once deep inside a note, before any collections even ones which contain the keyword dozens of times, and then all other record types last, even if their title is a precise match, then boost factors like 50 and 100 are appropriate. For a more subtle bias towards certain record types, without them totally dominating, start low and work upwards (the smallest boost you can apply is 1.1).


On Wed, 2020-01-08 at 15:39 +0000, Mayo, Dave wrote:
Hi Henry!

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.

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:

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" }}

To set it how you’d like it, you could take our BQ and adjust the values so that AOs > collections > etc., e.g.:

AppConfig[:solr_params] = {“bq” => proc { “primary_type:archival_object^100 OR primary_type:resource^50” }

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.

For more info on how bq works, consult the docs for Solr’s dismax parser: https://lucene.apache.org/solr/guide/6_6/the-dismax-query-parser.html

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.

If you’re on 2.6.0 or higher, you can do:

AppConfig[:solr_params] = {“bq” => [ ‘primary_type:archival_object^100’, ‘primary_type:resource^50’]}

which is technically “cleaner” by solr standards, but is equivalent in function as far as I can tell.

Dave Mayo (he/him)
Senior Digital Library Software Engineer
Harvard University > HUIT > LTS

From: <archivesspace_users_group-bounces at lyralists.lyrasis.org> on behalf of "Steele, Henry" <Henry.Steele at tufts.edu>
Reply-To: Archivesspace Users Group <archivesspace_users_group at lyralists.lyrasis.org>
Date: Tuesday, January 7, 2020 at 5:08 PM
To: Archivesspace Users Group <archivesspace_users_group at lyralists.lyrasis.org>
Subject: [Archivesspace_Users_Group] question about customizing search features in the ArchivesSpace PUI

Good afternoon,

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!

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.

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.

I thought of doing this in jquery, but this wouldn’t work because that would only sort the results on the page.

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.


Henry Steele
Systems Librarian
Tufts University Library Technology Services

Archivesspace_Users_Group mailing list
Archivesspace_Users_Group at lyralists.lyrasis.org<mailto:Archivesspace_Users_Group at lyralists.lyrasis.org>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20200109/9ab3ec67/attachment.html>

More information about the Archivesspace_Users_Group mailing list