如何在数据库中实现全文搜索

时间:2022-11-28 08:42:52

I understand that full text indexing and search for a database can be enabled by a lot of pre-packaged products. However, just out of academical curiosity, I wonder how are those full text indexes actually implemented. I have tried to google for results with little answer. Please any feedback would be much appreciated.

据我所知,许多预先打包的产品可以启用全文索引和搜索数据库。然而,出于学术界的好奇心,我想知道这些全文索引是如何实际实现的。我试图谷歌搜索结果很少回答。如有任何反馈意见,将不胜感激。

2 个解决方案

#1


3  

Full text searches are supported by quite a few database engines these days as a core feature.

目前,相当多的数据库引擎支持全文搜索作为核心功能。

As for implementation I think your best bet is to check out postgres full text searches, as you can

至于实施,我认为你最好的办法就是尽可能查看postgres全文搜索

  • find a lot of material on how it is implemented
  • 找到很多关于如何实施的材料
  • actually change and play with the parsers (for example optimize for certain domain)
  • 实际上改变和玩解析器(例如优化某些域)

There are further details and concept explained on wikipedia:

在*上解释了更多细节和概念:

  • full text indexes, and you can also check out
  • 全文索引,你也可以看看
  • open source and free full text search engines as normally you will find supporting documentation explaining inner workings of those too (I have heard good things about Lucene/Solr from this list)
  • 开源和免费的全文搜索引擎,通常你会找到支持文档解释那些内部工作(我从这个列表中听到了关于Lucene / Solr的好东西)

#2


-1  

Probably by creating dictionaries of "words" and maybe a bit of lexical analysis. (Note that fulltext searches whole words and not parts of words, so indexing may be constrained to that.)

可能是通过创建“单词”词典,也许还有一些词法分析。 (请注意,全文搜索整个单词而不是单词的一部分,因此索引可能会受到限制。)

#1


3  

Full text searches are supported by quite a few database engines these days as a core feature.

目前,相当多的数据库引擎支持全文搜索作为核心功能。

As for implementation I think your best bet is to check out postgres full text searches, as you can

至于实施,我认为你最好的办法就是尽可能查看postgres全文搜索

  • find a lot of material on how it is implemented
  • 找到很多关于如何实施的材料
  • actually change and play with the parsers (for example optimize for certain domain)
  • 实际上改变和玩解析器(例如优化某些域)

There are further details and concept explained on wikipedia:

在*上解释了更多细节和概念:

  • full text indexes, and you can also check out
  • 全文索引,你也可以看看
  • open source and free full text search engines as normally you will find supporting documentation explaining inner workings of those too (I have heard good things about Lucene/Solr from this list)
  • 开源和免费的全文搜索引擎,通常你会找到支持文档解释那些内部工作(我从这个列表中听到了关于Lucene / Solr的好东西)

#2


-1  

Probably by creating dictionaries of "words" and maybe a bit of lexical analysis. (Note that fulltext searches whole words and not parts of words, so indexing may be constrained to that.)

可能是通过创建“单词”词典,也许还有一些词法分析。 (请注意,全文搜索整个单词而不是单词的一部分,因此索引可能会受到限制。)