File tree Expand file tree Collapse file tree 3 files changed +15
-7
lines changed
main/java/org/apache/jackrabbit/oak/spi/query/fulltext
test/java/org/apache/jackrabbit/oak/spi/query/fulltext Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -29,8 +29,9 @@ public class VectorQuery {
2929 private static final String DEFAULT_INFERENCE_QUERY_CONFIG_PREFIX = "?" ;
3030 public static final String INFERENCE_QUERY_CONFIG_PREFIX_KEY = "org.apache.jackrabbit.oak.search.inference.query.prefix" ;
3131 public static final String INFERENCE_QUERY_CONFIG_PREFIX = System .getProperty (
32- INFERENCE_QUERY_CONFIG_PREFIX_KEY , DEFAULT_INFERENCE_QUERY_CONFIG_PREFIX );
32+ INFERENCE_QUERY_CONFIG_PREFIX_KEY , DEFAULT_INFERENCE_QUERY_CONFIG_PREFIX );
3333 public static final String EXPERIMENTAL_COMPATIBILITY_MODE_KEY = "oak.inference.experimental.compatibility" ;
34+ private static boolean isCompatibilityModeEnabled = Boolean .getBoolean (EXPERIMENTAL_COMPATIBILITY_MODE_KEY );
3435
3536 private final String queryInferenceConfig ;
3637 private final String queryText ;
@@ -80,8 +81,7 @@ private String[] parseText(String inputText) {
8081 // we return "{}" to be compatible with experimental inference queries
8182 jsonPart = "{}" ;
8283 queryTextPart = text ;
83- }
84- else {
84+ } else {
8585 jsonPart = "" ;
8686 queryTextPart = inputText ;
8787 }
@@ -102,7 +102,12 @@ public String getQueryText() {
102102 return queryText ;
103103 }
104104
105+ // to be used in tests.
106+ protected static void reInitializeCompatibilityMode () {
107+ isCompatibilityModeEnabled = Boolean .getBoolean (EXPERIMENTAL_COMPATIBILITY_MODE_KEY );
108+ }
109+
105110 private boolean isCompatibilityModeEnabled () {
106- return Boolean . getBoolean ( EXPERIMENTAL_COMPATIBILITY_MODE_KEY ) ;
111+ return isCompatibilityModeEnabled ;
107112 }
108113}
Original file line number Diff line number Diff line change @@ -28,15 +28,16 @@ public class VectorQueryCompatibilityModeTest {
2828
2929 @ Before
3030 public void setUp () {
31- // Set up any necessary system properties or configurations
31+ // Ensure compatibility mode is enabled for these tests
3232 System .setProperty (VectorQuery .EXPERIMENTAL_COMPATIBILITY_MODE_KEY , "true" );
33+ VectorQuery .reInitializeCompatibilityMode ();
3334 }
3435
3536 @ After
3637 public void tearDown () {
3738 // Clean up any system properties set during the tests
3839 System .clearProperty (VectorQuery .EXPERIMENTAL_COMPATIBILITY_MODE_KEY );
39- System . clearProperty ( VectorQuery .INFERENCE_QUERY_CONFIG_PREFIX_KEY );
40+ VectorQuery .reInitializeCompatibilityMode ( );
4041 }
4142
4243 @ Test
Original file line number Diff line number Diff line change @@ -30,12 +30,14 @@ public class VectorQueryTest {
3030 public void setUp () {
3131 // Ensure compatibility mode is disabled for these tests
3232 System .setProperty (VectorQuery .EXPERIMENTAL_COMPATIBILITY_MODE_KEY , "false" );
33+ VectorQuery .reInitializeCompatibilityMode ();
3334 }
3435
3536 @ After
3637 public void tearDown () {
37- // Clean up all system properties set during the tests
38+ // Clean up any system properties set during the tests
3839 System .clearProperty (VectorQuery .EXPERIMENTAL_COMPATIBILITY_MODE_KEY );
40+ VectorQuery .reInitializeCompatibilityMode ();
3941 }
4042
4143 @ Test
You can’t perform that action at this time.
0 commit comments