Object sort key

29 views
Skip to first unread message

Albert Min

unread,
Feb 15, 2021, 10:16:42 AM2/15/21
to archipelago commons
Hi,

Is there a default field for sorting objects?

Thanks!
Al

dp...@metro.org

unread,
Feb 15, 2021, 12:29:36 PM2/15/21
to archipelago commons
Hi Albert, good question!

Object Listings, both in the general Search as in Collection View (members) are driven by Drupal Views (quite standard) using the Solr index as data source. One of the nice things of that is that you have full access to setting/modifying or customizing default sort criteria and/or expose sort options via Exposed Filters/Exposed forms.

E.g, the general Search page , the one that you see when you use the search input in the Archipelago Deployment or any public site like play.archipelago.nyc, is this one 

(screenshot alert), The Sort criteria by default is "Changed" and that one is a ADO (NODE) level property, so not particular to the metadata stored as JSON in the Strawberryfield. Since this is Solr, the same rules as any solr apply, you can not sort on multivalued fields. And (this is on me, which brings a new need I may code) most of the exposed metadata elements in Archipelago to Solr are multivalued because of how Drupal deals with fields. This can be changed of course and I will open a tiny ISSUE to make this configurable (but no fear, you can already sort by multivalued thanks to dear friend Solr and Unicode Collation). 


Screen Shot 2021-02-15 at 11.57.16 AM.png

If you press on "add" by the Sort Criteria you will see a full list of Indexed fields coming from different "data sources", there is even one fun one named "relevance".  In this case I selected one coming from the actual the Metadata JSON key values we have exposed (Author) and I checked the "expose" this sort of visitors" so people can alter the sort Order (Pro tip, change the Label to something users can read and still fits in the Form input!)

Screen Shot 2021-02-15 at 12.03.38 PM.png

Now some internals:

Search API (Solr binding in Drupal) allows for Multivalued Fields to be indexed via special processor made specifically for Sorting. If you inspect your Solr Index (localhost:8983) you will notice there is a special sort_X3b_somelanguage* field for each string/textfield around. These fields are special case and can be used for sorting even if your data comes from multivalued source, e.g a list of subjects). More info here


We may want to explore more defaults for this and make a tut. Solr indexing is a full world of opportunities. Fun part is that 95% of all what is needed is UI/UX exposed via either the Search API index/processors and Fields and/or the Views settings. that 5% missing can be coded by us (and I may want to get some uses cases!)

Finally: making sort options look "good", Ajax driven, etc, can be done at the Views level and the theme level. So we may want to explore some better looking filters and UX for end users.

best!

Diego

Albert Min

unread,
Feb 15, 2021, 3:53:58 PM2/15/21
to archipelago commons
Hi, Diego. I had found the sort criteria in the views, but I was wondering if there was an existing configurable field somewhere just for sorting. It looks like there isn't from your answer, which is fine. Just exploring and was curious.

Thanks!
Al

dp...@metro.org

unread,
Feb 15, 2021, 4:25:09 PM2/15/21
to archipelago commons

Great. You may want to explore Fields and Indexing and how those are exposed in views more here http://localhost:8001/admin/config/search/search-api/index/default_solr_index/fields
If you have a particular use case (in the future, anytime) please do not hesitate to reach out

Have a great day

D

Albert Min

unread,
Feb 15, 2021, 9:18:56 PM2/15/21
to archipelago commons
That's helpful, thanks. I decided to run a low-stakes "production" instance on my home server at my personal domain so hopefully I'll have less basic questions going forward once I get my bearings.

Thanks again!
Al

Reply all
Reply to author
Forward
0 new messages