gpt4 book ai didi

google-app-engine - 谷歌数据存储错误 : No matching index found

转载 作者:太空宇宙 更新时间:2023-11-03 15:21:48 25 4
gpt4 key购买 nike

我想测试我在 Google 数据存储区中创建的新实体。我正在尝试使用不等式执行 GQL 查询以检索数据存储 Web 界面中的一些实体:

SELECT * FROM UserMatchingIndex WHERE age < 25 AND wants_male = false AND wants_dating = false AND wants_friendship = false AND wants_age = 20

但我总是遇到错误:“GQL 查询错误:您的数据存储没有此查询所需的复合索引(开发人员提供)。”而我已经定义了所需的复合索引!

UserMatchingIndex: age ▲ wants_male ▲ wants_dating ▲ wants_friendship ▲ wants_age ▲ Serving

UserMatchingIndex: age ▲ wants_female ▲ wants_dating ▲ wants_friendship ▲ wants_age ▲ Serving

这些在 index.yaml 中定义如下:

- kind: UserMatchingIndex
ancestor: no
properties:
- name: age
- name: wants_male
- name: wants_dating
- name: wants_friendship
- name: wants_age

- kind: UserMatchingIndex
ancestor: no
properties:
- name: age
- name: wants_female
- name: wants_dating
- name: wants_friendship
- name: wants_age

我真的看不出可能有什么问题......我已经为其他实体做过很多次了。如果您有一些线索,不客气。

最佳答案

此问题已提交给 Google Cloud 支持,这似乎是他们方面的问题,或者至少是尚未记录的限制。更改属性的顺序如下:

- kind: UserMatchingIndex
ancestor: no
properties:
- name: wants_male
- name: wants_dating
- name: wants_friendship
- name: wants_age
- name: age

使查询工作。

编辑:来自 Google 支持的回答

"The rows of an index table are sorted first by ancestor and then by property values, in the order specified in the index definition. The perfect index for a query, which allows the query to be executed most efficiently, is defined on the following properties, in order:

  1. Properties used in equality filters
  2. Property used in an inequality filter (of which there can be no more than one)
  3. Properties used in sort orders

This ensures that all results for every possible execution of the query appear in consecutive rows of the table."

应该尽快记录此限制。

关于google-app-engine - 谷歌数据存储错误 : No matching index found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36751214/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com