-
Notifications
You must be signed in to change notification settings - Fork 83
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 feature flag for QueryPhaseSearcher #214
Changes from 1 commit
1fa7e78
4985c33
3fabc54
55780e6
5142d3f
c1356cf
2617ca4
a63b983
a6c52bb
86b51f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
package org.opensearch.neuralsearch.plugin; | ||
|
||
import static org.mockito.Mockito.mock; | ||
import static org.opensearch.neuralsearch.plugin.NeuralSearch.NEURAL_SEARCH_HYBRID_SEARCH_DISABLED; | ||
import static org.opensearch.neuralsearch.plugin.NeuralSearch.NEURAL_SEARCH_HYBRID_SEARCH_ENABLED; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
@@ -42,15 +42,15 @@ public void testQueryPhaseSearcher() { | |
assertNotNull(queryPhaseSearcher); | ||
assertTrue(queryPhaseSearcher.isEmpty()); | ||
|
||
System.setProperty(NEURAL_SEARCH_HYBRID_SEARCH_DISABLED.getValue(), "true"); | ||
System.setProperty(NEURAL_SEARCH_HYBRID_SEARCH_ENABLED, "true"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we set this property in base class? and why test are extending OpenSearchTestCase, there is should be a base Neural Search test class There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking that for some unit tests we may want to disable it, that would be complex if it's set in base class. I'll make setting in a method and will call it in a setup phase for this test class. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure |
||
|
||
Optional<QueryPhaseSearcher> queryPhaseSearcherWithFeatureFlagDisabled = plugin.getQueryPhaseSearcher(); | ||
|
||
assertNotNull(queryPhaseSearcherWithFeatureFlagDisabled); | ||
assertFalse(queryPhaseSearcherWithFeatureFlagDisabled.isEmpty()); | ||
assertTrue(queryPhaseSearcherWithFeatureFlagDisabled.get() instanceof HybridQueryPhaseSearcher); | ||
|
||
System.setProperty(NEURAL_SEARCH_HYBRID_SEARCH_DISABLED.getValue(), ""); | ||
System.setProperty(NEURAL_SEARCH_HYBRID_SEARCH_ENABLED, ""); | ||
} | ||
|
||
public void testProcessors() { | ||
|
@@ -60,12 +60,4 @@ public void testProcessors() { | |
assertNotNull(processors); | ||
assertNotNull(processors.get(TextEmbeddingProcessor.TYPE)); | ||
} | ||
|
||
public void testFeature() { | ||
NeuralSearch plugin = new NeuralSearch(); | ||
Optional<String> feature = plugin.getFeature(); | ||
assertNotNull(feature); | ||
assertFalse(feature.isEmpty()); | ||
assertEquals(NEURAL_SEARCH_HYBRID_SEARCH_DISABLED.getKey(), feature.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.
The variable is already public we can remove @VisbleForTesting
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 made it public only because it's required for tests otherwise private will be enough, my understanding is that @VisbleForTesting is required in this case to mark that it's intentional.
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.
oh.. sorry my bad. I read it wrong then