php - Datastore:TextProperty(有这样的东西吗?)

时间:2014-02-09 14:16:54

标签: php google-cloud-datastore

我需要在google Datastore中存储一个长文本/字符串。此文本是序列化的关联数组,其大小为6.40 KB(超过500个字符)。 我正在使用Google AppEngine:PHP和google-api-php-client库。

到目前为止我所做的是使用这些方法:

  • stringValue的
  • stringValue + indexed = false;
  • blobValue
  • blobValue + indexed = false;
  • blobValue + blobKeyValue

但是我没有在lookup()中得到任何结果。当我将索引属性保留为默认值时,我在结果集中没有得到任何peroperty,当我将其设置为false(未索引)时,我只返回索引属性而没有其他值。当我还检查开发人员控制台时,它会显示属性值类型的“未知”。

在Python开发人员指南中有类似于我需要的内容:“

  

class TextProperty()   长串。

     

与StringProperty不同,TextProperty值的长度可超过500个字符。但是,TextProperty值未编入索引,因此无法在过滤器或排序顺序中使用。

有什么想法吗?请!

1 个答案:

答案 0 :(得分:3)

您可以对索引和未索引的字符串值使用stringValue,但索引值必须为< = 500个字符。

要插入超过500个字符的字符串属性,您必须明确将indexed设置为false,否则Cloud Datastore将不接受该实体。

https://developers.google.com/datastore/docs/concepts/entities#Datastore_Properties_and_value_types