You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by gi...@git.apache.org on 2017/09/05 09:36:01 UTC
[GitHub] garrensmith opened a new pull request #791: Check all indexed fields are in the selector
garrensmith opened a new pull request #791: Check all indexed fields are in the selector
URL: https://github.com/apache/couchdb/pull/791
Each mango json index is a filtered index, meaning that it only adds
documents to the index that have all the fields that are defined in the
index. So when selecing an index for a query we need to make sure that
all the fields defined in the index are also in the selector. Otherwise the
query could return incorrect results.
An example:
For documents:
```
{
name: "Garren",
location: "South Africa"
},
{
name: "Ed",
}
```
and with an index: `["name, "location"]. If we have a query like this:
```
selector: {name: {$gte: "E"}}
```
If it uses the above defined index it will only return the first document. Not both of them.
This PR changes it so that it will not use that index and rather use another index if there is or use _all_docs.
## Checklist
- [x] Code is written and works correctly;
- [x] Changes are covered by tests;
- [ ] Documentation reflects the changes;
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services