diff --git a/CHANGELOG.md b/CHANGELOG.md index 06617405..9b191fb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog All notable changes to this project will be documented in this file. +## [1.4.8] - 2025-02-03 +### Added +- Support for Subject Entities in Subject Builder + ## [1.4.7] - 2025-01-20 ### Changed - ClassWeb search will search `LCSH (w/names)` to do a combined search. diff --git a/src/components/panels/edit/modals/SubjectEditor.vue b/src/components/panels/edit/modals/SubjectEditor.vue index dacd8139..1c9b05bd 100644 --- a/src/components/panels/edit/modals/SubjectEditor.vue +++ b/src/components/panels/edit/modals/SubjectEditor.vue @@ -96,6 +96,8 @@ + @@ -877,6 +879,7 @@ export default { computed: { ...mapStores(usePreferenceStore), + ...mapStores(useConfigStore), ...mapState(usePreferenceStore, ['diacriticUseValues', 'diacriticUse', 'diacriticPacks']), ...mapState(useProfileStore, ['returnComponentByPropertyLabel', 'duplicateComponentGetId', 'isEmptyComponent']), @@ -1535,6 +1538,11 @@ export default { for (let x in this.searchResults.exact) { this.pickLookup[(this.searchResults.names.length - x) * -1 - 2] = this.searchResults.exact[x] } + + for (let x in this.searchResults.entities) { + this.pickLookup[x] = this.searchResults.entities[x] + + } }, // some context messing here, pass the debounce func a ref to the vue "this" as that to ref in the function callback @@ -2223,7 +2231,9 @@ export default { this.searchModeSwitch("GEO") } else if (event.ctrlKey && event.key == "4") { this.searchModeSwitch("HUBS") - } else if (this.searchMode == 'GEO' && event.key == "-") { + } else if (event.ctrlKey && event.key == "5") { + this.searchModeSwitch("ENTITIES") + } else if ((this.searchMode == 'GEO' || this.searchMode == 'ENTITIES') && event.key == "-") { if (this.components.length > 0) { let lastC = this.components[this.components.length - 1] diff --git a/src/components/panels/edit/modals/helpers/ComplexSearchResultsDisplay.vue b/src/components/panels/edit/modals/helpers/ComplexSearchResultsDisplay.vue index fbb240eb..cbcae5ad 100644 --- a/src/components/panels/edit/modals/helpers/ComplexSearchResultsDisplay.vue +++ b/src/components/panels/edit/modals/helpers/ComplexSearchResultsDisplay.vue @@ -76,6 +76,16 @@ @selectContext="selectContext" @emitLoadContext="loadContext" /> + + diff --git a/src/components/panels/edit/modals/helpers/DetailsPanel.vue b/src/components/panels/edit/modals/helpers/DetailsPanel.vue index f3895a1b..6da6c6a6 100644 --- a/src/components/panels/edit/modals/helpers/DetailsPanel.vue +++ b/src/components/panels/edit/modals/helpers/DetailsPanel.vue @@ -91,8 +91,7 @@ this.labelMap[key] : key }}: @@ -324,6 +323,12 @@ export default { }, methods: { + buildSource: function(source){ + if (source.includes("id.loc.gov")){ + source = source.replace(/(.*)(http.*id.loc.gov.*)$/g, '$1 $2') + } + return source + }, getUsabilityNote: function(data){ let notes = data.notes || [] let needsNote = notes.filter((i) => i.includes("CANNOT BE USED") ? true : false) diff --git a/src/lib/utils_network.js b/src/lib/utils_network.js index 2ff15df1..bab70077 100644 --- a/src/lib/utils_network.js +++ b/src/lib/utils_network.js @@ -20,7 +20,7 @@ const utilsNetwork = { lookupLibrary : {}, //Controllers to manage searches - controllers: { + controllers: { // there's got to be a better way "controllerNames": new AbortController(), "controllerNamesGeo": new AbortController(), "controllerNamesSubdivision": new AbortController(), @@ -45,6 +45,7 @@ const utilsNetwork = { "exactName": new AbortController(), "exactSubject": new AbortController(), "lccnSearchController": new AbortController(), + "controllerEntities": new AbortController(), }, subjectSearchActive: false, @@ -548,7 +549,6 @@ const utilsNetwork = { url = url.replace('searchtype=','searchtype=keyword') } - let r = await this.fetchSimpleLookup(url, false, searchPayload.signal) //Config only allows 25 results, this will add something to the results @@ -2471,6 +2471,8 @@ const utilsNetwork = { let exactSubject = exactUri.replace('', 'subjects') //children's subjects is supported by known-label lookup? + let subjectEntitiesUrl = useConfigStore().lookupConfig['http://id.loc.gov/authorities/subjects'].modes[0]['ENTITIES'].url.replace('',searchVal).replace('&count=25','&count=50').replace("", "1") + if (mode == 'GEO'){ subjectUrlHierarchicalGeographic = subjectUrlHierarchicalGeographic.replace('&count=4','&count=12').replace("", "1") } @@ -2641,6 +2643,14 @@ const utilsNetwork = { signal: this.controllers.controllerHubsKeyword.signal, } + let searchPayloadEntities = { + processor: 'lcAuthorities', + url: [subjectEntitiesUrl], + searchValue: searchVal, + subjectSearch: true, + signal: this.controllers.controllerEntities.signal, + } + let resultsNames =[] @@ -2667,6 +2677,8 @@ const utilsNetwork = { let resultsExactName = [] let resultsExactSubject = [] + let resultsEntities = [] + // this.searchExact(exactPayloadName), // this.searchExact(exactPayloadSubject), // resultsExactName, resultsExactSubject, @@ -2724,6 +2736,10 @@ const utilsNetwork = { this.searchComplex(searchPayloadHubsKeyword) ]); + } else if (mode == "ENTITIES"){ + [resultsEntities] = await Promise.all([ + this.searchComplex(searchPayloadEntities) + ]); } // drop the litearl value from names and complex @@ -2758,6 +2774,10 @@ const utilsNetwork = { resultsSubjectsSimpleComplex.push(resultsSubjectsSimpleComplex.pop()) } + if (resultsEntities.length>0){ + resultsEntities.push(resultsEntities.pop()) + } + // resultsSubjectsComplex.reverse() @@ -2850,7 +2870,8 @@ const utilsNetwork = { 'hierarchicalGeographic': pos == 0 ? [] : resultsHierarchicalGeographic, 'subjectsChildren': pos == 0 ? resultsChildrenSubjects : resultsChildrenSubjectsSubdivisions, 'subjectsChildrenComplex': resultsChildrenSubjectsComplex, - 'exact': exact + 'exact': exact, + 'entities': resultsEntities, } this.subjectSearchActive = false diff --git a/src/stores/config.js b/src/stores/config.js index 17d61b6c..cd44990b 100644 --- a/src/stores/config.js +++ b/src/stores/config.js @@ -7,7 +7,7 @@ export const useConfigStore = defineStore('config', { versionMajor: 1, versionMinor: 4, - versionPatch: 7, + versionPatch: 8, @@ -551,6 +551,7 @@ export const useConfigStore = defineStore('config', { 'LCSH Auth Subjects':{"url":"http://id.loc.gov/authorities/subjects/suggest2/?q=&memberOf=http://id.loc.gov/authorities/subjects/collection_LCSHAuthorizedHeadings&count=25&offset=&searchtype=left"}, 'LCSH SubDiv Subjects':{"url":"http://id.loc.gov/authorities/subjects/suggest2/?q=&memberOf=http://id.loc.gov/authorities/subjects/collection_Subdivisions&count=25&offset=&searchtype=left"}, 'LCSH GnFrm Subjects':{"url":"http://id.loc.gov/authorities/genreForms/suggest2/?q=&memberOf=http://id.loc.gov/authorities/genreForms/collection_LCGFT_General&count=25&offset=&searchtype=left"}, + 'ENTITIES': {"url":"https://id.loc.gov/entities/subjects/suggest2/?q=&count=25&offset=&searchtype=left"} } ] },