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

Mayo, Dave dave_mayo at harvard.edu
Wed Jan 8 10:39:56 EST 2020


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.

Thanks

Henry Steele
Systems Librarian
Tufts University Library Technology Services
(617)627-5239

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20200108/41cec255/attachment.html>


More information about the Archivesspace_Users_Group mailing list