中图法分类

This commit is contained in:
2026-11-04 14:08:14 +08:00
parent 0d8fdbd35a
commit 4f3fc578d0
2 changed files with 15 additions and 5 deletions
@@ -312,7 +312,7 @@ public class SearchServiceImpl implements SearchService {
applyMatch(w, "cdoi", q.getCdoi(), q.getMatchType()); applyMatch(w, "cdoi", q.getCdoi(), q.getMatchType());
if (!excludeClc && StrUtil.isNotBlank(q.getClcCode())) { if (!excludeClc && StrUtil.isNotBlank(q.getClcCode())) {
w.likeRight("clc_code", q.getClcCode().trim()); w.likeRight("clc_code", q.getClcCode().trim().toUpperCase());
} }
// 中图法树导航:点部类时传入其下所有大类号,任一命中即可 // 中图法树导航:点部类时传入其下所有大类号,任一命中即可
if (!excludeClc && CollectionUtil.isNotEmpty(q.getClcCodes())) { if (!excludeClc && CollectionUtil.isNotEmpty(q.getClcCodes())) {
@@ -326,7 +326,7 @@ public class SearchServiceImpl implements SearchService {
x.or(); x.or();
} }
first = false; first = false;
x.likeRight("clc_code", c.trim()); x.likeRight("clc_code", c.trim().toUpperCase());
} }
}); });
} }
+13 -3
View File
@@ -59,15 +59,16 @@ function metaValue(row: VersionResource, key: string): string {
/** 输入框内容(与查询参数分离,避免按途径分发后被清空) */ /** 输入框内容(与查询参数分离,避免按途径分发后被清空) */
const input = ref('') const input = ref('')
const field = ref('综合') const field = ref('综合')
const fields = ['综合', '题名', '责任者', '关键词', '出版社', 'ISBN'] const fields = ['综合', '题名', '责任者', '关键词', '出版社', '中图分类', 'ISBN']
/** 检索途径 → 查询参数字段 */ /** 检索途径 → 查询参数字段 */
const fieldParamMap: Record<string, 'keyword' | 'title' | 'author' | 'publisher' | 'isbn'> = { const fieldParamMap: Record<string, 'keyword' | 'title' | 'author' | 'publisher' | 'clcCode' | 'isbn'> = {
综合: 'keyword', 综合: 'keyword',
题名: 'title', 题名: 'title',
责任者: 'author', 责任者: 'author',
关键词: 'keyword', 关键词: 'keyword',
出版社: 'publisher', 出版社: 'publisher',
中图分类: 'clcCode',
ISBN: 'isbn' ISBN: 'isbn'
} }
@@ -80,6 +81,7 @@ const hitFieldMap: Record<string, string[]> = {
责任者: ['author'], 责任者: ['author'],
关键词: ['keywords'], 关键词: ['keywords'],
出版社: ['publisher'], 出版社: ['publisher'],
中图分类: ['clcCode'],
ISBN: ['isbn'] ISBN: ['isbn']
} }
@@ -89,6 +91,7 @@ const fieldLabels: Record<string, string> = {
keywords: '关键词', keywords: '关键词',
summary: '摘要', summary: '摘要',
publisher: '出版者', publisher: '出版者',
clcCode: '中图分类',
isbn: 'ISBN' isbn: 'ISBN'
} }
@@ -134,7 +137,14 @@ async function doSearch() {
// 按所选途径分发检索词;多词用空格分隔,词与词之间为 AND // 按所选途径分发检索词;多词用空格分隔,词与词之间为 AND
const kw = input.value.trim() const kw = input.value.trim()
query.title = query.author = query.publisher = query.isbn = query.keyword = '' query.title = query.author = query.publisher = query.isbn = query.keyword = ''
;(query as unknown as Record<string, string>)[fieldParamMap[field.value]] = kw query.clcCode = ''
const fp = fieldParamMap[field.value]
// 用检索框按中图分类检索时,清掉左侧分类树的点选,避免两套 CLC 条件叠加
if (fp === 'clcCode') {
query.clcCodes = undefined
selectedClc.value = ''
}
;(query as unknown as Record<string, string>)[fp] = kw
// 去除关键字:多个排除词以空格拼接提交后端统一排除 // 去除关键字:多个排除词以空格拼接提交后端统一排除
query.excludeKeyword = excludeTerms.value.length ? excludeTerms.value.join(' ') : '' query.excludeKeyword = excludeTerms.value.length ? excludeTerms.value.join(' ') : ''
try { try {