Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
12 changes: 11 additions & 1 deletion src/components/panels/edit/modals/SubjectEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@
<!-- <button @click="searchModeSwitch('WORKS')" :data-tooltip="'Shortcut: CTRL+ALT+4'" :class="['simptip-position-bottom',{'active':(searchMode==='WORKS')}]">Works</button> -->
<button @click="searchModeSwitch('HUBS')" :data-tooltip="'Shortcut: CTRL+ALT+4'"
:class="['simptip-position-bottom', { 'active': (searchMode === 'HUBS') }]">Hubs</button>
<button @click="searchModeSwitch('ENTITIES')" :data-tooltip="'Shortcut: CTRL+ALT+5'"
:class="['simptip-position-bottom', { 'active': (searchMode === 'ENTITIES') }]" v-if="configStore.returnUrls.env == 'staging'">Entities</button>
</div>


Expand Down Expand Up @@ -877,6 +879,7 @@ export default {

computed: {
...mapStores(usePreferenceStore),
...mapStores(useConfigStore),
...mapState(usePreferenceStore, ['diacriticUseValues', 'diacriticUse', 'diacriticPacks']),
...mapState(useProfileStore, ['returnComponentByPropertyLabel', 'duplicateComponentGetId', 'isEmptyComponent']),

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@
@selectContext="selectContext"
@emitLoadContext="loadContext"
/>

<SearchResultOption
searchType="entities"
label="Subject Entities"
index="ix"
:searchResults="searchResults"
:pickLookup="pickLookup"
@selectContext="selectContext"
@emitLoadContext="loadContext"
/>
</div>
</div>
</template>
Expand Down
9 changes: 7 additions & 2 deletions src/components/panels/edit/modals/helpers/DetailsPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@
this.labelMap[key] : key }}:</span>
<ul>
<li class="modal-context-data-li" v-if="Array.isArray(contextData[key])"
v-for="(v, idx) in contextData[key]" v-bind:key="'var' + idx">
{{ v }}
v-for="(v, idx) in contextData[key]" v-bind:key="'var' + idx" v-html="buildSource(v)">
</li>
</ul>
</template>
Expand Down Expand Up @@ -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 <a href="$2" _target="blank">$2</a>')
}
return source
},
getUsabilityNote: function(data){
let notes = data.notes || []
let needsNote = notes.filter((i) => i.includes("CANNOT BE USED") ? true : false)
Expand Down
27 changes: 24 additions & 3 deletions src/lib/utils_network.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -45,6 +45,7 @@ const utilsNetwork = {
"exactName": new AbortController(),
"exactSubject": new AbortController(),
"lccnSearchController": new AbortController(),
"controllerEntities": new AbortController(),
},
subjectSearchActive: false,

Expand Down Expand Up @@ -548,7 +549,6 @@ const utilsNetwork = {
url = url.replace('searchtype=<TYPE>','searchtype=keyword')
}


let r = await this.fetchSimpleLookup(url, false, searchPayload.signal)

//Config only allows 25 results, this will add something to the results
Expand Down Expand Up @@ -2471,6 +2471,8 @@ const utilsNetwork = {
let exactSubject = exactUri.replace('<SCHEME>', '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('<QUERY>',searchVal).replace('&count=25','&count=50').replace("<OFFSET>", "1")

if (mode == 'GEO'){
subjectUrlHierarchicalGeographic = subjectUrlHierarchicalGeographic.replace('&count=4','&count=12').replace("<OFFSET>", "1")
}
Expand Down Expand Up @@ -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 =[]
Expand All @@ -2667,6 +2677,8 @@ const utilsNetwork = {
let resultsExactName = []
let resultsExactSubject = []

let resultsEntities = []

// this.searchExact(exactPayloadName),
// this.searchExact(exactPayloadSubject),
// resultsExactName, resultsExactSubject,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -2758,6 +2774,10 @@ const utilsNetwork = {
resultsSubjectsSimpleComplex.push(resultsSubjectsSimpleComplex.pop())
}

if (resultsEntities.length>0){
resultsEntities.push(resultsEntities.pop())
}

// resultsSubjectsComplex.reverse()


Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/stores/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const useConfigStore = defineStore('config', {

versionMajor: 1,
versionMinor: 4,
versionPatch: 7,
versionPatch: 8,



Expand Down Expand Up @@ -551,6 +551,7 @@ export const useConfigStore = defineStore('config', {
'LCSH Auth Subjects':{"url":"http://id.loc.gov/authorities/subjects/suggest2/?q=<QUERY>&memberOf=http://id.loc.gov/authorities/subjects/collection_LCSHAuthorizedHeadings&count=25&offset=<OFFSET>&searchtype=left"},
'LCSH SubDiv Subjects':{"url":"http://id.loc.gov/authorities/subjects/suggest2/?q=<QUERY>&memberOf=http://id.loc.gov/authorities/subjects/collection_Subdivisions&count=25&offset=<OFFSET>&searchtype=left"},
'LCSH GnFrm Subjects':{"url":"http://id.loc.gov/authorities/genreForms/suggest2/?q=<QUERY>&memberOf=http://id.loc.gov/authorities/genreForms/collection_LCGFT_General&count=25&offset=<OFFSET>&searchtype=left"},
'ENTITIES': {"url":"https://id.loc.gov/entities/subjects/suggest2/?q=<QUERY>&count=25&offset=<OFFSET>&searchtype=left"}
}
]
},
Expand Down