检索技术原理
BestNav 对目录中的文件执行两路索引:一路是传统的倒排索引(Inverted Index),用于文件名、扩展名与可提取正文的精确关键词匹配;另一路是语义索引——对文本类内容先做分块(chunking),再通过本地或自托管的 embedding 模型将每个片段编码为向量,写入本地向量库。检索时,你的查询同样被向量化,按余弦相似度(Cosine Similarity)召回最相近的片段,从而实现"理解意图"而非"字面匹配"。
- 关键词检索:基于倒排索引,毫秒级、零额外依赖
- 语义检索:Query 与文档片段做向量化后按相似度排序
- 混合排序(Hybrid):关键词命中与语义得分融合,兼顾精确与召回
- 全程本地推理:embedding 可走本机 CPU 推理或你自建的推理服务,数据不出内网
系统会对常见格式做文本抽取后再建索引:纯文本与代码(txt/md/json/代码源文件等)直接读取;文档类(PDF / DOCX / XLSX / PPTX / EPUB)经解析提取正文;媒体文件(视频/音乐/图片)以元数据(标题、字幕、EXIF、专辑信息等)参与检索。二进制或加密文件在不破坏原文件的前提下跳过正文提取,仅索引文件名。
- 文本/代码:直接建索引
- PDF / Office / EPUB:解析正文后建索引
- 影音/图片:以文件名与元数据建索引
- 大文件分块(chunk)建索引,避免单文档占用过多内存
建立索引
在「设置 → 文件搜索」中添加需索引的目录(如影音库、文档盘、代码仓库)。系统以只读方式后台遍历,建立索引时不改动、不复制原文件;支持按扩展名/路径设置包含与排除规则,并可为不同目录配置独立权重。
- 只读遍历,原文件零写入
- 索引进度可视化,超大目录可分批、可断点续建
- 支持增量更新:仅对新增/变更文件重算
- 索引库与向量库均存于本地,不上传任何云端
使用方式
索引完成后,在首页搜索栏切换到「文件」分类即可检索。输入如"去年旅行拍的视频""Q3 财务报表"这类自然语言,语义检索会返回最相关的结果;也可直接输入文件名片段做精确匹配。点击结果可在线预览或直接打开对应路径,配合影音库实现"一搜即播"。
- 顶部搜索栏切换「文件」分类检索
- 自然语言 / 关键词双模式,自动融合排序
- 结果可预览、可跳转原路径
- 与影音库、文档盘联动,搜索到播放/打开一步到位
How It Works
BestNav runs two indexing pipelines. One is a classic inverted index for exact keyword matching over filenames, extensions and extracted text. The other is semantic: text content is chunked, then encoded into vectors by a local or self-hosted embedding model and stored in a local vector store. At query time your input is vectorized too and the nearest chunks are recalled by cosine similarity — so it understands intent, not just literal strings.
- Keyword: inverted index, millisecond, zero extra deps
- Semantic: query vs chunk vectors ranked by similarity
- Hybrid ranking: keyword + semantic scores fused for precision & recall
- Local inference only: embedding via on-device CPU or your own service, data stays on LAN
Common formats are text-extracted before indexing: plain text and code (txt/md/json/source) read directly; documents (PDF / DOCX / XLSX / PPTX / EPUB) parsed for body text; media (video/music/images) indexed by metadata (title, subtitle, EXIF, album, etc.). Binaries or encrypted files are skipped for body extraction without modifying the original — only the filename is indexed.
- Text / code: indexed directly
- PDF / Office / EPUB: body text extracted first
- Media: indexed by filename + metadata
- Large files chunked to avoid memory spikes
Build Index
In Settings → File Search, add directories to index (media library, docs, repos). The system traverses read-only in the background and never writes or copies originals; include/exclude rules by extension or path are supported, with per-directory weights.
- Read-only traversal, zero writes to originals
- Visual progress; huge dirs indexed in batches, resumable
- Incremental update: only new/changed files re-indexed
- Index & vector store local only — nothing uploaded
How To Use
After indexing, switch the home search bar to the Files tab. Type natural language like "videos from last year’s trip" or "Q3 financial report" — semantic search returns the most relevant hits; or type a filename fragment for exact match. Click a result to preview or jump to its path, with search-to-play through your media library.
- Switch search bar to Files tab
- Natural language / keyword dual mode, auto-fused ranking
- Results previewable and jump-to-path
- Works with media library & docs — search to play/open in one step