如何实现快速搜索你索引文件? [英] How do you Index Files for Fast Searches?

查看:182
本文介绍了如何实现快速搜索你索引文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,微软和谷歌将索引硬盘驱动器上的文件,这样可以快速搜索的内容。

Nowadays, Microsoft and Google will index the files on your hard drive so that you can search their contents quickly.

我想知道的是他们是如何做到这一点呢?你能描述算法?

What I want to know is how do they do this? Can you describe the algorithm?

推荐答案

最简单的情况下是一个反向索引。

The simple case is an inverted index.

最基本的算法很简单:

  • 扫描单词的文件,创造了独特的单词列表
  • 规范和筛选的话
  • 将到文件中的条目搭售这个词在你的首页

的细节是,事情变得棘手,但基本面是相同的。

The details are where things get tricky, but the fundamentals are the same.

按规范和过滤器的话,我的意思是一样的东西都转换为小写,除去常见的停用词(即,如果在一个等),可能是词干(用于动词去除常见的后缀和复数等等)。

By "normalize and filter" the words, I mean things like converting everything to lowercase, removing common "stop words" (the, if, in, a etc.), possibly "stemming" (removing common suffixes for verbs and plurals and such).

在这之后,你有话独特的列表中的文件,你可以建立自己的指数掉了。

After that, you've got a unique list of words for the file and you can build your index off of that.

有优化,减少仓储,技术检查单词的地方(就是这个近是的文件中,例如)。

There are optimizations for reducing storage, techniques for checking locality of words (is "this" near "that" in the document, for example).

不过,这是它的工作的根本途径。

But, that's the fundamental way it's done.

这篇关于如何实现快速搜索你索引文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆