我想查詢資料儲存庫,我的查詢錯誤看起來是這樣的:GQL查詢問題,Google數據存儲問題。有多個條件和大於和小於運營商
SELECT *
FROM mydb
WHERE Latitude = "18.1" AND Number > "1"
它不工作,雖然。我得到這個錯誤的數據存儲查詢框中:
GQL query error: Your Datastore does not have the composite index (developer-supplied) required for this query.
而這個錯誤,當我跑我的代碼:
SELECT *
FROM mydb
WHERE Number > "1" AND Number < "5"
我只訪問:
no matching index found. recommended index is:\n- kind: mydb\n properties:\n - name: Location\n - name: Number\n
喜歡這個工作簡單的請求這裏可能只有一列,那是爲什麼?
不,
然後我試圖像這樣的請求:
SELECT *
FROM mydb
WHERE Latitude = "18.1" AND Number = "1"
這個工作。
我試圖尋找一個解決方案,我碰到這個頁面來了:https://cloud.google.com/datastore/docs/tools/indexconfig#Datastore_About_index_yaml
通過該頁面會後,我得知我需要一個index.yaml中文件的某處。它應該放在名爲WEB-INF的文件夾中。但我沒有這個文件夾。
這是我的一小段代碼:
Query<Entity> query = Query
.gqlQueryBuilder(Query.ResultType.ENTITY,
"SELECT * FROM " + kind + " WHERE Location = @location AND Number <= @number")
.setBinding("number", "5").setBinding("location", "18.1").build();
QueryResults<Entity> results = datastore.run(query);
你的'appengine-web.xml'位於哪裏? – Nicholas
@Nicholas我沒有任何地方,我的程序可以部署和運行沒有它。 –
你可以發佈你的應用程序的完整目錄結構嗎? – Nicholas