fix(brand-questions): accept generic search terms in lexicon validation
Deployment Config CI / Deployment Config (push) Successful in 27s
Frontend CI / Frontend (push) Successful in 2m53s
Backend CI / Backend (push) Successful in 16m53s
Desktop Client Build / Resolve Build Metadata (push) Waiting to run
Desktop Client Build / Build Desktop Client (push) Blocked by required conditions
Desktop Client Build / Publish Client Artifacts to NAS (push) Has been cancelled
Deployment Config CI / Deployment Config (push) Successful in 27s
Frontend CI / Frontend (push) Successful in 2m53s
Backend CI / Backend (push) Successful in 16m53s
Desktop Client Build / Resolve Build Metadata (push) Waiting to run
Desktop Client Build / Build Desktop Client (push) Blocked by required conditions
Desktop Client Build / Publish Client Artifacts to NAS (push) Has been cancelled
Search terms like "全屋定制" or "GEO排名优化" were rejected as invalid because both the Vue candidate validator and the Go question_metadata classifier required interrogative cues (什么/如何/为什么/...). Lexicon entries are search terms, not questions, so require only letters or digits plus the existing 4-char minimum. Rename helpers to searchTermLooksValid/questionLooksValid to reflect the looser semantics, and relabel the navigation entry from "公司和词库" to "品牌和词库" to match the actual domain.
This commit is contained in:
@@ -506,12 +506,12 @@ function normalizeSearchTermText(value: string): string {
|
||||
.replace(/\s+/g, '')
|
||||
}
|
||||
|
||||
function questionLooksLikeQuestion(value: string): boolean {
|
||||
function searchTermLooksValid(value: string): boolean {
|
||||
const text = normalizeSearchTermText(value)
|
||||
if (text.length < 4) {
|
||||
return false
|
||||
}
|
||||
return /什么|如何|怎么|哪|为什么|是否|能不能|适合|区别|对比|推荐/.test(text)
|
||||
return /[\p{L}\p{N}]/u.test(text)
|
||||
}
|
||||
|
||||
function toCandidateRows(candidates: QuestionCandidate[]): CandidateRow[] {
|
||||
@@ -519,7 +519,7 @@ function toCandidateRows(candidates: QuestionCandidate[]): CandidateRow[] {
|
||||
.map((candidate, index) => {
|
||||
const text = normalizeSearchTermText(candidate.text)
|
||||
const tooShort = text.length < 4
|
||||
const invalid = !questionLooksLikeQuestion(text)
|
||||
const invalid = !searchTermLooksValid(text)
|
||||
return {
|
||||
...candidate,
|
||||
text,
|
||||
@@ -545,7 +545,7 @@ function buildLocalCandidates(texts: string[], source: QuestionSource): Candidat
|
||||
seen.add(key)
|
||||
const tooShort = text.length < 4
|
||||
const duplicate = existingQuestionSet.value.has(key) || duplicateInBatch
|
||||
const invalid = !questionLooksLikeQuestion(text)
|
||||
const invalid = !searchTermLooksValid(text)
|
||||
rows.push({
|
||||
id: `${Date.now()}-${rows.length}-${text}`,
|
||||
text,
|
||||
@@ -682,7 +682,7 @@ function refreshCandidate(row: CandidateRow): void {
|
||||
)
|
||||
row.too_short = row.text.length < 4
|
||||
row.duplicate = Boolean(key) && (existingQuestionSet.value.has(key) || duplicateInBatch)
|
||||
row.suggest_skip = row.too_short || row.duplicate || !questionLooksLikeQuestion(row.text)
|
||||
row.suggest_skip = row.too_short || row.duplicate || !searchTermLooksValid(row.text)
|
||||
}
|
||||
|
||||
function refreshAllCandidates(): void {
|
||||
|
||||
Reference in New Issue
Block a user