-
Notifications
You must be signed in to change notification settings - Fork 16
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 no-index support for Shredder (part 1) #786
Conversation
…t change anything
this( | ||
allowed, | ||
denied, | ||
Suppliers.memoize(() -> DocumentProjector.createForIndexing(allowed, denied))); |
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.
This is done so that DocumentProjector
is only created first time it is needed (if at all) and reused if used in future (as CollectionSettings
are effectively cached)
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.
Overall looks good, can you clarify on the comments?
} | ||
|
||
public DocumentProjector indexingProjector() { | ||
return indexedProject.get(); |
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.
This does build the Projector for every call. Is the idea to get this once use it in code passing everywhere?
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.
No, it uses Guava's memoize() to avoid just that.
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'll try to come up with a test to verify that we only get one instance; maybe CreateCollectionCommandResolverTest
?
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.
Ok, easier to verify with stand-alone unit test: see CollectionSettingsTest
which verifies that instance is created dynamically, and then same instance returned for further calls to get instance.
// Note that (5) is effectively same as (3) and included for sake of uniformity | ||
if (allowed != null && !allowed.isEmpty()) { | ||
// (special) Case 5: | ||
if (allowed.size() == 1 && allowed.contains("*")) { |
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.
allowed can't have *
, it's only supported for denied.
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.
That is something I wanted to discuss (should have brought up) -- for consistency it would make sense to allow this. But for minimal approach not. Will ask on Stargate channel.
My main concern is if users would pass this, assuming it works, and it meaning something totally different.
"""; | ||
|
||
// Try with overlapping paths | ||
assertDenyProjection(Arrays.asList("a", "a.b"), INPUT_DOC, EXP_OUTPUT); |
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.
What will be the output if denied list is only "a.b"? Will we index field "a.b.z"?
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.
We take most generic path, first, so this is same as only using "a"
.
And so a
, a.b
, a.b.c
would all be excluded (not indexed).
// First with empty Sets: | ||
assertAllowProjection(Arrays.asList(), DOC, DOC); | ||
// And then "*" notation | ||
assertAllowProjection(Arrays.asList("*"), DOC, DOC); |
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.
Not a valid case.
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.
Related to earlier comment: so, correct, depends on our definition.
What this PR does:
Adds index allow/deny handling to
Shredder
based onIndexingConfig
added via CreateCollectionWhich issue(s) this PR fixes:
Fixes #767
Checklist