使用数据存储区(NDB),Search API或两者来查看数据? [英] Use the Datastore (NDB), the Search API or both for views on data?

查看:94
本文介绍了使用数据存储区(NDB),Search API或两者来查看数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在CMS中,使用常规NDB查询和订购来检索客户列表。为了允许过滤名称,公司名称和电子邮件,我创建了几个(有时是很多)索引。这种情况并不理想,但是可行。



现在有(实验性)搜索API 。它似乎与数据存储(或NDB)没有关系,但我的数据已经存在。



我想使用全文搜索并将过滤器放在多个那么我应该将数据保存在数据存储区中,并且在Search API的Documents中复制部分数据?或者,如搜索示例建议,跳过Datastore完全。

解决方案

我不太确定推荐的方法是用于实现的,但Search API似乎设计为主要用作附加的手动管理索引。在大多数情况下,将您的所有数据存储在Search API中是不理想的,因为您可以轻松地将搜索API索引的大小与不需要过滤或搜索的字段一并删除,也不会很好地用于需要定期写入的情况。 我的个人建议是将所有数据留在NDB中,设计类使用Search API创建包含相关可搜索数据的文档,保持两种介质之间的一致性每次写入数据存储版本时都要更新Search API版本(或者如果您正在写数据,则使用任务/ cron或类似的系统)。在过滤相关数据的Search API文档时,您应该存储您在UI中呈现的所有数据,因为手动加入搜索API结果和数据存储区数据不必要的密集,并且会严重减慢整个过程。

In a CMS, a list of customers is retrieved using a regular NDB query with ordering. To allow filtering on name, company name and email, I create several (sometimes many) indices. The situation was not ideal, but workable.

Now there's the (experimental) Search API. It seems to have no relation to the datastore (or NDB), but my data is already there.

I'd like to use Full Text Search and put filters on multiple fields simultaniously, so should I keep my data in the Datastore and duplicate parts of the data in Documents for the Search API? Or, as the search example suggests, skip the Datastore entirely.

解决方案

I'm not quite sure what the recommended method is for its implementation, but the Search API seems designed to be utilized primarily as an additional, manually managed index. Its not ideal in most situations to store all of your data in the Search API, as you can easily blow out the size of the search API indexes with fields which you never need to filter or search, nor is it well designed to be utilized in situation where regular writes are necessary.

My personal recommendation is to leave all of your data in NDB, and design classes to create documents containing the relevant searchable data using the Search API, maintaining consistency between the two medium's by updating the Search API version each time a write is made to the datastore version (or using tasks/crons or a similar system if you're writing data a lot). You should store any data you present in the UI when filtering in the Search API documents for that related data, as manually joining the search API results and the datastore data is unnecessarily intensive, and will severely slow down the whole process.

这篇关于使用数据存储区(NDB),Search API或两者来查看数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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