-
Notifications
You must be signed in to change notification settings - Fork 10
Call Number Browse
A Call Number Browse in SearchWorks starts at a title (or in our case with a ckey). We have a field in our documents that contains a preferred barcode (whose algorithm is determined by the indexing code). This preferred barcode is used as the starting point unless another barcode is provided (as can be the case for records with holdings in different classification ranges).
The relevant call number, shelf-key, and reverse shelf-key are gathered from the record's item_display
field using the provided barcode (see more about shelf-keys below) We first take the reverse shelf-key, pass it to the Solr's Terms Component to get the next (sorted lexically) reverse shelf-keys (which will give us the revere shelf-keys for the call numbers "behind" the call number for the given key reverse shelf-key since it's "reverse"). We then take those reverse shelf-keys make a query to solr to return the documents that have those reverse shelf-keys. Now we do the same thing but with the shelf-key (pass it to the term's component, take the returned shelf-keys, and fetch documents that have those shelf-keys) to get the relevant documents. We take the documents from the reverse shelf-key, append the original document, then append the documents returned from the shelf-key to create the result set of documents for a given browse.
Paging backward or forward through the result set effectively takes the page number and uses it to figure out how many terms are needed (starting from the original document) in order to render the browse page but only processes the number of terms needed to render the given browse page (which is why sometimes call number browse pages can have <=> 20 documents on a given page).
A simplified explanation for how our shelf-keys and reverse shelf-keys work (WRT fetching and sorting documents for a call number browse) is that if we have three documents:
id: 1
call_number: AAA
shelfkey: aaa
reverse_shelfkey: zzz
id: 2
call_number: BBB
shelfkey: bbb
reverse_shelfkey: yyy
id: 3
call_number: CCC
shelfkey: ccc
reverse_shelfkey: xxx
Solr's terms component isn't able to tell us that aaa
and bbb
come before ccc
but we are able to accomplish that using the reverse shelf-key (because yyy
and zzz
come after xxx
).
Note, this is a vast over-simplification of shelf-keys. There are a lot of transformations that go into generating the shelf-keys and reverse shelf-keys in order for the keys to sort in the expected call number order.