Skip to content

SearchManager

SearchManager 通过 Application.sharedInstance().searchManager 获取。其返回结构与索引能力会随版本变化;建议先在控制台打印返回值结构再做兼容处理。

属性类型说明
ftsIndexingbooleanFTS 索引是否正在构建/工作中。
propIndexingboolean属性索引是否正在构建/工作中。
vectorIndexingboolean向量索引是否正在构建/工作中。
方法说明
searchText(query, titleOnly, topicid, beginsWith, limit)文本搜索。
searchTextNoteOnly(query, titleOnly, topicid, beginsWith, limit, noteOnly)文本搜索(可限定只搜笔记)。
searchTextWordList(textWordLst, titleOnly, topicid, beginsWith, limit)使用分词列表进行搜索。
searchFts3Text(query, titleOnly, topicid, limit, noteOnly)通过 FTS3 搜索(实现依赖运行时)。
searchURLs(urls, topicid)按 URL 列表搜索。
searchPage(query, beginsWith, limit)页内搜索(实现依赖运行时)。
snippetForFts3RowId(rowid) / snippetForPageRowId(rowid)获取 snippet(结果摘要)。
方法说明
syncTopicForceBlock(topicid, force, block)同步/构建指定笔记本的索引(block 为回调)。
syncDB() / syncDBAfterMigration()同步索引数据库。
hasTopicIndex(topicid) / hasVectorIndex(topicid) / hasBookIndex(md5)检查索引是否存在。
resetBookIndex()重置文档索引(慎用)。
方法说明
findSimilarNotes(queryVector, topicId, k)向量相似笔记检索。
batchFindSimilarNotes(queryVectors, topicId, k)批量向量相似检索。
findSimilarNotesHybrid(queryVector, queryText, topicId, k, semanticWeight, bm25Weight)语义+BM25 混合检索。
loadVectorCacheForTopic(topicId) / syncTopicVectorsForceCompletion(topicId, force, completion) / invalidateVectorCacheForTopics(topicIds)向量缓存相关(实现依赖运行时)。
  • ApplicationApplication.sharedInstance().searchManager
头文件 API 清单

正在加载…

协议:,来源: