指标函数
当我尝试在索引函数中索引doc的子属性时,比如ret.add(doc.complaint.status, {field: 'status', type: 'string'}) couchdb返回500。
function (doc) {
var ret = new Document();
ret.add(doc.customerName, {
type: 'string',
field: 'customerName'
});
ret.add(doc.complaint.status, {
type: 'string',
field: 'status'
});
ret.add(doc.complaint.numberOfCoupons, {
type: 'int',
field: 'numberOfCoupons'
});
return ret;
}
在couchdb中存在的
{ "customerName": "Roman Maltsev", "complaint": { "status": "In progress", "numberOfCoupons": 10 } }
使用代理GET http://localhost:5984/_fti/local/complaints-management-rom/_design/find/all?q=status:"In progress"的查询返回500
发布于 2017-09-10 14:42:23
实际上,问题是lucene索引每个文档,包括_design/view本身,所以我只需要检查是否存在属性
https://stackoverflow.com/questions/46141339
复制相似问题