如何为所有英文单词设计一个 NoSQL 数据库?

How can I design a NoSQL database for all English words?

我想知道最有效的方法是为所有英文单词设计一个 NoSQL 数据库。我正在考虑创建不同的文档,例如wordlength-1、wordlength-2、wordlength-3、wordlength-4等将分别存储所有长度为1、2、3的单词。每个这样的文档将存储多个对象,例如 A、B、C ...、Z,其中 A 将存储所有以 'A' 开头的单词,B 将存储所有以 'B' 开头的单词,依此类推.

wordlength-3 : {
     A : { act, art, ass, ... },
     B : {bat, bot, bug ...},
}
  1. 我们如何使用像 ape*t 这样的模式或基于单词的长度和单词的首字母来有效地搜索单词?
  2. 是否有任何其他方法来设计这样的数据库,以便非常有效地完成任何搜索?

要进行搜索,您可以使用弹性搜索。它还以非结构化方式存储文档,因为保存在 NoSQL.It 中将有助于解决您的两个问题。

Elasticsearch uses a data structure called an inverted index that supports very fast full-text searches. An inverted index lists every unique word that appears in any document and identifies all of the documents each word occurs in.

[1]https://www.elastic.co/what-is/elasticsearch

有助于在近real-time内快速搜索数据,并在毫秒内给出答案