MCPcopy Create free account
hub / github.com/chokcoco/iCSS / createSearchContent

Method createSearchContent

MCP/scripts/fetch-issues.js:790–823  ·  view source on GitHub ↗
(issue)

Source from the content-addressed store, hash-verified

788 }
789
790 createSearchContent(issue) {
791 // 更好地处理标签
792 const labels = Array.isArray(issue.labels)
793 ? issue.labels
794 .map(label => typeof label === 'string' ? label : label.name)
795 .join(' ')
796 : '';
797
798 const body = issue.body || '';
799
800 // 移除markdown语法,提取纯文本用于搜索
801 const cleanBody = body
802 .replace(/```[\s\S]*?```/g, ' ') // 移除代码块
803 .replace(/`([^`]+)`/g, '$1') // 移除行内代码
804 .replace(/[#*_~]/g, '') // 移除markdown格式
805 .replace(/\[([^\]]+)\]\([^)]+\)/g, '$1') // 移除链接,保留文本
806 .replace(/\s+/g, ' ') // 标准化空白字符
807 .trim();
808
809 // 构建更丰富的搜索内容
810 const searchContent = [
811 issue.title,
812 labels,
813 cleanBody,
814 // 添加标签的不同组合形式,以提高匹配率
815 ...labels.split(' ').filter(Boolean),
816 // 为某些常见的组合词添加变体
817 labels.includes('奇技淫巧') ? '技巧 奇技' : '',
818 labels.includes('动画') ? '动效 特效' : '',
819 labels.includes('特殊交互') ? '交互 动效' : ''
820 ].filter(Boolean).join(' ');
821
822 return searchContent.substring(0, 1000); // 限制长度
823 }
824
825 generateStats() {
826 this.db.all('SELECT COUNT(*) as total FROM issues', (err, rows) => {

Callers 1

saveIssuesToDatabaseMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected