You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "Garren Smith (JIRA)" <ji...@apache.org> on 2016/05/10 14:45:13 UTC

[jira] [Created] (COUCHDB-3015) $ne and sort query not falling back to using _all_docs

Garren Smith created COUCHDB-3015:
-------------------------------------

             Summary: $ne and sort query not falling back to using _all_docs
                 Key: COUCHDB-3015
                 URL: https://issues.apache.org/jira/browse/COUCHDB-3015
             Project: CouchDB
          Issue Type: Bug
          Components: Mango
            Reporter: Garren Smith


if I create an index like this

var index = {
     "index": {
       "fields": ["foo"]
      },
     "name": "foo-index",
     "type": "json"
};

And then query it with this

{
    selector: {foo: {$ne: "eba"}},
    fields: ["_id" ],
    sort: [{foo: "asc"}]
}

I then get this result
{
   warning: 'no matching index found, create an index to optimize query time',
   docs: [
     {_id: '1'},
     {_id: '2'},
     {_id: '4'}
    ]
}

Which is correct. But if I do not create the index above. And just run this
{
  selector: {foo: {$ne: "eba"}},
  fields: ["_id", "foo"],
  sort: [{"foo": "asc"}]
}

I get an error of this
`Unknown Error: mango_idx :: {no_usable_index,missing_sort_index}`

Which doesn’t make sense to be. Because in both causes it should default to using the _all_docs index and send the results along with the index.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)