Item sort order via API requirements

Item sort order via API requirements

Feature

https://folio-org.atlassian.net/browse/UXPROD-5257

Documentation draft

complete

Contents

Overview

Currently, items are sorted in FOLIO based on barcode value; however, this is not always the desired sorting of items, especially on discovery layers for patrons and staff using the OPAC. The desired sort may be on free text values that are not sortable, such as chronology and enumeration.

Use cases:

  • Display sorted values for patrons and other library staff (such as Reference librarians) on discovery layers

  • For FOLIO staff users:

    • For example, we receive a serial publication out of order. The item for volume 10 is created before the item for volume 9, thus the barcode number is smaller and 10 displays before 9. I want to save them displayed in numeric order.

Requirement

Notes

Status

Requirement

Notes

Status

1

Ability to define how items are sorted

  • Currently, items are sorted in FOLIO based on barcode value; however, this is not always the desired sorting of items, especially on discovery layers for patrons and staff using the OPAC.

  • The desired sort may be on free text values that are not sortable, such as chronology

  • There may be hundreds of items and it is difficult to find known items and to identify gaps in the collection

complete

2

No deduplication/validation of defined sort order

  • If the implementation follows the pattern of a numeric sort order field that libraries change, we do not need to make sure that users haven’t duplicated this numeric value

complete

3

Retain existing default sort order (for existing items), require manual re-sort

  • When a configurable sort order is added, the current state sorting is based on the default. We need to retain this sort upon implementation.

complete

4

For newly created items, sort at the bottom of the order

 

complete

5

Add sort order to RTAC schema response

https://folio-org.atlassian.net/wiki/spaces/FOLIJET/pages/1384120 https://folio-org.atlassian.net/wiki/spaces/FOLIJET/pages/1395735

complete

6

Do not need to update sort order on the UI

complete

7

When libraries migrate to FOLIO, retain sort order from previous system

  • In other systems, there is a sort order field that contains a numeric value that is updated based on a manual sort via the UI. We need to retain how the items are sorted from the previous system when libraries migrate to FOLIO

complete

Summary of solution

https://folio-org.atlassian.net/wiki/spaces/SPITFIRE/pages/938082365

  1. There will be a new required numeric field for item sort order in the schema

  2. There will be a new endpoint to set the value of order field

  3. This new field should be exposed on the UI and could be updated via the UI or API

  4. When libraries initially migrate to FOLIO, they will be able to map their sort order numeric values to this new field

  5. For existing items in FOLIO, there will be a background job that needs to be run to populate the new item sort order field with the existing order of the items

  6. For newly created items, setting the item sort order field should be supported via the UI along with the API

    1. If the user inserts a newly created item into the sort order field on the UI, UI will be able to increment the sort order of the succeeding existing items automatically. This would support and future drag and drop functionality, or support entering a numeric value on the item detail record.

    2. If the user inserts a newly created item into the sort order field via API, likely by entering a sort order value that already exists, we will not be able to auto increment succeeding item sort orders and we will not be able to sort the items with duplicate sort orders - the sort amongst these items would be random

Process flows

Note: UI implementation will be in scope of different feature https://folio-org.atlassian.net/browse/UXPROD-1625 .

image-20250716-122416.png

 

image-20250716-122326.png
image-20250716-122353.png