couchdb - 如何为我的 Hyperledger Fabric 链码部署 couchDb 索引?
问题描述
我正在尝试使用 couchdb 索引部署链代码,但它不起作用。我使用 Hyperledger Fabric 版本 2.0 alpha 并且我的链码正在运行。
这是我的索引
{"index":{"fields":["price"]},"ddoc":"indexPriceDoc", "name":"indexPrice","type":"json"}
这是文件夹结构:chaincode\META-INF\statedb\couchdb\indexes\indexPrice.json
这是我的链码中的查询
queryString := fmt.Sprintf("{\"selector\":{\"timeSlot\":\"%s\"},\"sort\":[{\"price\":\"asc\"}], \"use_index\":[ \"indexPriceDoc\",\"indexPrice\" ]}", subscribe.TimeSlot)
iterator, err := stub.GetQueryResult(queryString)
在我的日志文件中执行查询时,我发现此错误:
2019-06-12 09:59:05.714 UTC [shim] handleGetQueryResult -> ERRO 005 [0f072238] Received ERROR
2019-06-12 09:59:05.714 UTC [offer] Error -> ERRO 006 Error querying offers: GET_QUERY_RESULT failed: transaction ID: 0f072238990b15b22696060305140880c6694028c1fac300511090f433dc2583: error handling CouchDB request. Error:no_usable_index, Status Code:400, Reason:No index exists for this sort, try indexing by the sort fields.
错误是什么?
解决方案
关闭网络并再次使用索引安装和实例化链代码。当设置多个索引时,我也面临同样的问题。
推荐阅读
- sql - SQL选择不同的数据而不对列进行排序
- python - Python中的树遍历
- sql-server - 在 SQL Server 2014 / SQL Server 2016 中连接表的多行
- clojure - 打印行末尾不需要的 %
- java - 超类中带有@Autowire的Spring bean
- java - 守护进程立即停止 JVM 垃圾收集器抖动并在 JVM 内存耗尽后停止
- reactjs - 如何在客户端缓存反应组件?
- r - 使用 ggsurvplot() + geom_dl() 时的“二元运算符的非数字参数”
- tensorflow - 使用 CUDA 运行的 TensorFlow 对象检测 API
- azure - Azure SAS 连接不适用于 Azure.Storage.Blobs