-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Rename selector to partialfilterselector in indexes #818
Rename selector to partialfilterselector in indexes #818
Conversation
It needs rebasing on master but basically looks good to me. What happens if both |
@willholley I've just rebased |
@garrensmith I think we should follow the convention for other fields and use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
partial_filter_selector for a name would be better to match the established naming convention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nearly there, I think. Possibly an issue with existing indexes that have a selector
property though.
src/mango/src/mango_cursor.erl
Outdated
@@ -92,7 +92,7 @@ maybe_filter_indexes_by_ddoc(Indexes, Opts) -> | |||
{use_index, []} -> | |||
%We remove any indexes that have a selector |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably add a space here
src/mango/src/mango_idx.erl
Outdated
@@ -44,7 +44,7 @@ | |||
to_json/1, | |||
delete/4, | |||
get_usable_indexes/3, | |||
get_idx_selector/1 | |||
get_idx_partial_filter_selector/1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to get_partial_filter_selector
- that it is in the mango_idx
module implies that it relates to an index
src/mango/src/mango_idx.erl
Outdated
Mod:validate_new(Idx1, Db). | ||
|
||
|
||
maybe_rename_idx_fields({Props}) -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to maybe_rename_fields
src/mango/test/03-operator-test.py
Outdated
@@ -185,7 +185,7 @@ def test_lt_includes_null_but_not_missing(self): | |||
|
|||
def test_lte_includes_null_but_not_missing(self): | |||
docs = self.db.find({ | |||
"twitter": {"$lt": 1} | |||
"twitter": {"$lte": 1} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this into a separate PR as it's unrelated
after squashing, looks ok to me |
@davisp I've made all the required changes. Could you take a look when you get a chance. |
@@ -199,8 +199,8 @@ opts() -> | |||
{tag, fields}, | |||
{validator, fun mango_opts:validate_sort/1} | |||
]}, | |||
{<<"selector">>, [ | |||
{tag, selector}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the get_legacy_selector code above, but reading through code I can't convince myself that removing this option definition won't break old indexes that used the selector name. I wonder if we shouldn't continue to support this for awhile and upgrade it internally for new indexes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And/or perhaps just adding a test specifically for the upgrade would be enough here. And for that I'd like to see us write an old style ddoc directly and then read the index to make sure it behaves as expected.
To make it easier to distinguish between a selector in _find and a selector in _index. Rename the selector in the _index to partialfilterselector. It also gives a bit more of an explanation of what this selector does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
To make it easier to distinguish between a selector in _find and a selector in _index. Rename the selector in the _index to partialfilterselector. It also gives a bit more of an explanation of what this selector does.
To make it easier to distinguish between a selector in _find and a selector in _index. Rename the selector in the _index to partialfilterselector. It also gives a bit more of an explanation of what this selector does.
To make it easier to distinguish between a selector in _find and a
selector in _index. Rename the selector in the _index to
partialfilterselector. It also gives a bit more of an explanation of
what this selector does.
Checklist