gre*_*ell 8 postgresql recursion
可以说我有一本这样的书:
{ title: "Tis no book"
chapter: 1,
text: "Hello world this is a book chapter",
subchapters: [
{
chapter: 1.1
text: "Nested sub chapter"
subchapters: [
chapter: 1.1.1
text: "Nested nested..."
subchapters: [ ...etc...]
},
{
chapter: 1.2
text: "Nested sub chapter 2"
subchapters: [ ...etc...]
}
]
}
Run Code Online (Sandbox Code Playgroud)
我可以使用postgres'9.4 new jsonb/gin(或其他任何东西)在"text"这个递归嵌套数据结构的字段上设置全文索引,以便可以通过文本搜索存储到数据库的书库(使用索引) )?
juh*_*ist -1
我不会回答这个问题;相反,我将建议一种完全不同的方法。
您是否看过 Lucene,https://lucene.apache.org/core/?在数据库中实现全文搜索是糟糕的设计。您应该使用单独的全文索引器,例如 Lucene。Lucene文档应该引用数据库键,可以用来查找数据库中的真实记录。
通过使用 Lucene,您很可能会获得比使用数据库的全文搜索功能更好的性能。此外,Lucene 比数据库更容易扩展。
| 归档时间: |
|
| 查看次数: |
2858 次 |
| 最近记录: |