Reputation: 24588
I would like to search all fields in my document without having to specify the field name when using a Cloudant Search index.
The cloudant docs provide an example of a default field indexing on the 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});
}
}
The docs also provide this description:
If the special value "default" is used when defining the name, you do not have to specify a field name at query time.
Can I define more that one "default" index? E.g.
function(doc){
index("default", doc._id);
index("default", doc.min_length, {"store": true});
...
}
Upvotes: 0
Views: 72
Reputation: 405
Yes, you can define as many "default" indexes at you like. It seems that even mixing types should be fine for queries.
Upvotes: 1