{"id":21496564,"url":"https://github.com/mlibrary/callnumber_poc","last_synced_at":"2025-03-17T12:16:06.911Z","repository":{"id":46154325,"uuid":"421238422","full_name":"mlibrary/callnumber_poc","owner":"mlibrary","description":null,"archived":false,"fork":false,"pushed_at":"2021-11-10T19:11:39.000Z","size":35,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-23T21:53:26.739Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mlibrary.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-26T01:23:50.000Z","updated_at":"2021-10-27T18:09:44.000Z","dependencies_parsed_at":"2022-08-26T16:02:01.396Z","dependency_job_id":null,"html_url":"https://github.com/mlibrary/callnumber_poc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlibrary%2Fcallnumber_poc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlibrary%2Fcallnumber_poc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlibrary%2Fcallnumber_poc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlibrary%2Fcallnumber_poc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mlibrary","download_url":"https://codeload.github.com/mlibrary/callnumber_poc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244031154,"owners_count":20386534,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-23T16:17:12.427Z","updated_at":"2025-03-17T12:16:06.892Z","avatar_url":"https://github.com/mlibrary.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Callnumber browse proof-of-concept\n\nThis is a simple Rails app as a PoC of callnumber browse.\n\nOn the one hand, it works. On the other...\n\nTo try it out:\n\n* Make sure you're on the library VPN, since it talks to search-prep\n* Clone this repo and `bundle install`\n* `rails server` to fire it up\n* ...and go to the URL\n\nNote that the number of rows is currently set to 5 just because having\na long screen of callnumbers makes debugging so much harder. Also, the \nindex on search-prep only has Alma stuff in it (no Zephir), which \nshouldn't make a difference for this use case. \n\n## How it works\n\nWe start with custom java code that allows Solr to manipulate the \ncallnumbers as they come such that they index in a way that sorts \nreasonably well. \n\n(Note that the hard part was getting all the solr bits of it working; if \nwe decide we want to tweak the sort-index algorithm for the callnumbers it \nshould be pretty easy.)\n\nI then created a side-core that has three columns:\n  * callnumber (must be LC)\n  * bib_id\n  * id: a sortable-key made of the callnumber/bib_id pair\n\nIt's populated by taking _all_ of the LC callnumbers from a record (from \nthe 852s, falling back to the 050 if it can't find anything else) and \nputting in one row per callnumber. Thus records with multiple callnumbers \nin 852s will appear in more than one place in the list.\n\nTo populate a new side core from scratch takes a little over an hour, but \nif we \nput datestamps on our catalog records indicating when they were indexed, \nit should be possible to just grab the record that were indexed \"today\" and \nbuzz through them one at a time. We could also potentially build this into \nthe regular indexing process, but it'd be a little messy (probably have to \nbuild a special writer and call it from an `each_record` block in the \ntraject code). \n\nThe query is then done against the side core, and the bib_ids returned are \nused to gather actual records from the catalog solr (with just a `bib_id: \n1 OR 2 OR 3 OR ...`). \n\n## What's in the URL?\n\n* `callnumber` is the original search callnumber. It's used to populate \n  the search box and drive the search on the first page\n* `page` starts at 0 and goes up/down every time you hit next/previous. \n  When page = 0, we know we're on a \"first page\" and need to do that whole \n  \"Your search would appear here\" bit.\n* `key` is the callnumber/bib_id combination key created for the \n  callnumber side-core. \n\n## What works, however ugly-ly\n\n* Takes into account semantics of callnumber numeric part (e.g., browsing \n  on 'PA1' won't get you the 'PA 1000' area)\n* Deals with finding the edges of the list via `#has_previous_page` and\n  `#has_next_page`\n* Figures out if you have an exact match and puts in a placeholder if not\n\n## What the code needs\n\n* Refactoring. Lots of it. Everything is currently stuck in one big file \n  with a bunch of classes in it (`lib/callnumber_models.rb`)\n* It should probably notice when two items on the same page are actually \n  the same record. I have no idea if that's happening or not, but it'd \n  look weird. \n* The script that creates the side-core is dumb as a thumb, and doesn't \n  even deal with solr errors correctly. It could benefit from perhaps \n  parallelization, and certainly from using a traject-like writer that \n  takes care of all the hard stuff. \n* Someone to talk me through naming. The names are awful.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlibrary%2Fcallnumber_poc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmlibrary%2Fcallnumber_poc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlibrary%2Fcallnumber_poc/lists"}