【发布时间】:2016-11-16 21:13:05
【问题描述】:
我想在使用 Cloudant 搜索索引时搜索文档中的所有字段,而不必指定字段名称。
cloudant docs 提供了 doc._id 上默认字段索引的示例:
function(doc){
index("default", doc._id);
if (doc.min_length){
index("min_length", doc.min_length, {"store": true});
}
if (doc.diet){
index("diet", doc.diet, {"store": true});
}
if (doc.latin_name){
index("latin_name", doc.latin_name, {"store": true});
}
if (doc.class){
index("class", doc.class, {"store": true});
}
}
文档也提供了这样的描述:
如果在定义名称时使用特殊值“default”,则不必在查询时指定字段名称。
我可以定义多个“默认”索引吗?例如
function(doc){
index("default", doc._id);
index("default", doc.min_length, {"store": true});
...
}
【问题讨论】: