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

Mayo, Dave dave_mayo at harvard.edu
Thu Jan 9 08:58:36 EST 2020


This is super useful!

One caveat re bq being space separated, that’s only true IF you have q.op unset or set explicitly to “OR” – if you change q.op, it affects bq identically to q, so the boost queries will become ANDed as well, and since nothing can have multiple primary types, the bq will do nothing.

--
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 Andrew Morrison <andrew.morrison at bodleian.ox.ac.uk>
Reply-To: Archivesspace Users Group <archivesspace_users_group at lyralists.lyrasis.org>
Date: Thursday, January 9, 2020 at 5:21 AM
To: Archivesspace Users Group <archivesspace_users_group at lyralists.lyrasis.org>
Subject: Re: [Archivesspace_Users_Group] question about customizing search features in the ArchivesSpace PUI

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).

Andrew.


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<https://urldefense.proofpoint.com/v2/url?u=https-3A__lucene.apache.org_solr_guide_6-5F6_the-2Ddismax-2Dquery-2Dparser.html&d=DwMGaQ&c=WO-RGvefibhHBZq3fL85hQ&r=_Mv1dY22K7jvT5MD7xjbvGVzRDOUMhx4WYcnPSIzYnE&m=4qxuV7g4RP-HIbimkIt2sAOG2pUqvutYsjt5uuWjYik&s=GHSTumGgJkdaEBsAJFe-dMlXts0xBKmeqbuFbjaA7QE&e=>

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


_______________________________________________

Archivesspace_Users_Group mailing list

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

http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group<https://urldefense.proofpoint.com/v2/url?u=http-3A__lyralists.lyrasis.org_mailman_listinfo_archivesspace-5Fusers-5Fgroup&d=DwMGaQ&c=WO-RGvefibhHBZq3fL85hQ&r=_Mv1dY22K7jvT5MD7xjbvGVzRDOUMhx4WYcnPSIzYnE&m=4qxuV7g4RP-HIbimkIt2sAOG2pUqvutYsjt5uuWjYik&s=tIbNoSGOd_gkCZLsn59iqC1tS4belCsPKslryOeyBfs&e=>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20200109/e1cbdbd7/attachment.html>


More information about the Archivesspace_Users_Group mailing list