dbul?

这是一个库,它借鉴了飞镖靶中心点“双箭”(double bullseye,简称为d-bull)的名字。该库是用 dart 编写的,并旨在提供最佳的全文本搜索(FTS)得分。

索引

我们旨在通过文档索引来查找匹配项。正如我们在最早的维基百科示例(Novus Atlas Sinensis)中所展示的,文本用于指代其来自的页面。

原始来源

我们将此称为倒排索引,参考自 维基百科页面

In computer science, an inverted index (also referred to as a postings list, postings file, or inverted file) is a database index storing a mapping from content, such as words or numbers, to its locations in a table, or in a document or a set of documents

创建倒排索引的步骤

为了生成这个倒排索引,我们将采取以下步骤:

  1. 检索要分析字段的文本
  2. 获取输入文本并将其转换为一个标记列表,即对文本进行分词
  3. 过滤/转换标记,以在匹配太多文档和匹配太少文档之间找到平衡。示例过滤器包括小写转换、删除停用词、词干提取或使用n-gram。

索引步骤 来源

假设上述示例是ID 3,并且存在其他与标记匹配的类似文档,则生成的索引将如下所示:

[
    "open": [ 3, 4, 12],
    "president": [12 ,3 ],
    "procession": [ 3, 4 5],
    ...
]

分词

…待办

灵感

用150行Python代码构建一个全文本搜索引擎 Lunrjs.com

GitHub

查看 Github