首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用couchdb-lucene索引嵌套对象

如何使用couchdb-lucene索引嵌套对象
EN

Stack Overflow用户
提问于 2017-09-10 13:42:05
回答 1查看 335关注 0票数 0

指标函数

当我尝试在索引函数中索引doc的子属性时,比如ret.add(doc.complaint.status, {field: 'status', type: 'string'}) couchdb返回500。

代码语言:javascript
复制
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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-09-10 14:42:23

实际上,问题是lucene索引每个文档,包括_design/view本身,所以我只需要检查是否存在属性

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46141339

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档