New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add selector support for json indexes #808

Merged
merged 6 commits into from Sep 14, 2017

Conversation

Projects
None yet
2 participants
@garrensmith
Member

garrensmith commented Sep 12, 2017

Adds selector support to json indexes. The selector can be used to
filter what documents are added to the index. When executing a query
the index will only be used if the index is specified in the use_index
field.

Checklist

  • Code is written and works correctly;
  • Changes are covered by tests;
  • Documentation reflects the changes;

@garrensmith garrensmith referenced this pull request Sep 12, 2017

Closed

Add selector support to json indexes #775

2 of 3 tasks complete
@willholley

Just a few more edge cases to test and an indexing optimisation.

Show outdated Hide outdated src/mango/src/mango_native_proc.erl Outdated
resp = self.db.find(selector, explain=True)
self.assertEqual(resp["index"]["name"], "_all_docs")
def test_doesnot_use_selector_when_not_specified_with_index(self):

This comment has been minimized.

@willholley

willholley Sep 12, 2017

Member

I think we need to test that specifying an invalid partial index fails appropriately. This should follow the same rules as global indexes i.e. an index cannot be used if it does not map to the selector and sort order specified in the query.

@willholley

willholley Sep 12, 2017

Member

I think we need to test that specifying an invalid partial index fails appropriately. This should follow the same rules as global indexes i.e. an index cannot be used if it does not map to the selector and sort order specified in the query.

resp = self.db.find(selector, explain=True)
self.assertEqual(resp["index"]["name"], "_all_docs")
def test_doesnot_use_selector_when_not_specified_with_index(self):

This comment has been minimized.

@willholley

willholley Sep 12, 2017

Member

Final thought it that we should run these same tests for partial text indexes to verify consistent behaviour - perhaps that's a separate PR though.

@willholley

willholley Sep 12, 2017

Member

Final thought it that we should run these same tests for partial text indexes to verify consistent behaviour - perhaps that's a separate PR though.

Show outdated Hide outdated src/mango/test/mango.py Outdated
Show outdated Hide outdated src/mango/test/mango.py Outdated
@@ -115,6 +115,16 @@ filter_indexes(Indexes0, DesignId, ViewName) ->
lists:filter(FiltFun, Indexes).
remove_indexes_with_selector(Indexes) ->

This comment has been minimized.

@garrensmith

garrensmith Sep 13, 2017

Member

add comment here around why we removing these indexes

@garrensmith

garrensmith Sep 13, 2017

Member

add comment here around why we removing these indexes

@willholley

a small bit of duplication that could be removed but otherwise looks good to me.

Show outdated Hide outdated src/mango/src/mango_native_proc.erl Outdated

garrensmith added some commits Sep 12, 2017

Add selector support for json indexes
Adds selector support to json indexes. The selector can be used to
filter what documents are added to the index. When executing a query
the index will only be used if the index is specified in the use_index
field.

@garrensmith garrensmith merged commit ed6ec66 into apache:master Sep 14, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

garrensmith added a commit to garrensmith/couchdb-documentation that referenced this pull request Sep 14, 2017

@garrensmith garrensmith referenced this pull request Sep 14, 2017

Closed

Add index selector docs #162

0 of 3 tasks complete

@willholley willholley referenced this pull request Oct 6, 2017

Merged

Fix exists false when field is explicitly defined #863

2 of 3 tasks complete

wohali added a commit that referenced this pull request Oct 19, 2017

Add selector support for json indexes (#808)
* Add selector support for json indexes

Adds selector support to json indexes. The selector can be used to
filter what documents are added to the index. When executing a query
the index will only be used if the index is specified in the use_index
field.

willholley added a commit to willholley/couchdb that referenced this pull request May 22, 2018

Add selector support for json indexes (apache#808)
* Add selector support for json indexes

Adds selector support to json indexes. The selector can be used to
filter what documents are added to the index. When executing a query
the index will only be used if the index is specified in the use_index
field.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment