chenboat commented on code in PR #13948:
URL: https://github.com/apache/pinot/pull/13948#discussion_r1775754177
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/store/TextIndexUtils.java:
##########
@@ -279,19 +284,56 @@ public static Constructor<QueryParserBase>
getQueryParserWithStringAndAnalyzerTy
// Fail-fast if the query parser is specified class is not QueryParseBase
class
final Class<?> queryParserClass = Class.forName(queryParserClassName);
if (!QueryParserBase.class.isAssignableFrom(queryParserClass)) {
- throw new ReflectiveOperationException("The specified lucene query
parser class " + queryParserClassName
- + " is not assignable from " + QueryParserBase.class.getName());
+ throw new ReflectiveOperationException(
+ "The specified lucene query parser class " + queryParserClassName +
" is not assignable from "
+ + QueryParserBase.class.getName());
}
// Fail-fast if the query parser does not have the required constructor
used by this class
try {
queryParserClass.getConstructor(String.class, Analyzer.class);
} catch (NoSuchMethodException ex) {
throw new NoSuchMethodException("The specified lucene query parser class
" + queryParserClassName
- + " is not assignable from does not have the required
constructor method with parameter type "
- + "[String.class, Analyzer.class]"
- );
+ + " is not assignable from does not have the required constructor
method with parameter type "
+ + "[String.class, Analyzer.class]");
}
return (Constructor<QueryParserBase>)
queryParserClass.getConstructor(String.class, Analyzer.class);
}
+
+ public static void writeConfigToPropertiesFile(File indexDir,
TextIndexConfig config) {
+ PropertiesConfiguration properties = new PropertiesConfiguration();
+ List<String> escapedLuceneAnalyzerClassArgs =
config.getLuceneAnalyzerClassArgs().stream()
+
.map(CommonsConfigurationUtils::replaceSpecialCharacterInPropertyValue).collect(Collectors.toList());
+ List<String> escapedLuceneAnalyzerClassArgTypes =
config.getLuceneAnalyzerClassArgTypes().stream()
+
.map(CommonsConfigurationUtils::replaceSpecialCharacterInPropertyValue).collect(Collectors.toList());
+
+ properties.setProperty(FieldConfig.TEXT_INDEX_LUCENE_ANALYZER_CLASS,
config.getLuceneAnalyzerClass());
+ properties.setProperty(FieldConfig.TEXT_INDEX_LUCENE_ANALYZER_CLASS_ARGS,
escapedLuceneAnalyzerClassArgs);
+
properties.setProperty(FieldConfig.TEXT_INDEX_LUCENE_ANALYZER_CLASS_ARG_TYPES,
escapedLuceneAnalyzerClassArgTypes);
+ properties.setProperty(FieldConfig.TEXT_INDEX_LUCENE_QUERY_PARSER_CLASS,
config.getLuceneQueryParserClass());
+
+ File propertiesFile = new File(indexDir,
V1Constants.Indexes.LUCENE_TEXT_INDEX_PROPERTIES_FILE);
+ CommonsConfigurationUtils.saveToFile(properties, propertiesFile);
+ }
+
+ public static TextIndexConfig getUpdatedConfigFromPropertiesFile(File file,
TextIndexConfig config)
Review Comment:
Add javadoc to public methods.
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/store/TextIndexUtils.java:
##########
@@ -279,19 +284,56 @@ public static Constructor<QueryParserBase>
getQueryParserWithStringAndAnalyzerTy
// Fail-fast if the query parser is specified class is not QueryParseBase
class
final Class<?> queryParserClass = Class.forName(queryParserClassName);
if (!QueryParserBase.class.isAssignableFrom(queryParserClass)) {
- throw new ReflectiveOperationException("The specified lucene query
parser class " + queryParserClassName
- + " is not assignable from " + QueryParserBase.class.getName());
+ throw new ReflectiveOperationException(
+ "The specified lucene query parser class " + queryParserClassName +
" is not assignable from "
+ + QueryParserBase.class.getName());
}
// Fail-fast if the query parser does not have the required constructor
used by this class
try {
queryParserClass.getConstructor(String.class, Analyzer.class);
} catch (NoSuchMethodException ex) {
throw new NoSuchMethodException("The specified lucene query parser class
" + queryParserClassName
- + " is not assignable from does not have the required
constructor method with parameter type "
- + "[String.class, Analyzer.class]"
- );
+ + " is not assignable from does not have the required constructor
method with parameter type "
+ + "[String.class, Analyzer.class]");
}
return (Constructor<QueryParserBase>)
queryParserClass.getConstructor(String.class, Analyzer.class);
}
+
+ public static void writeConfigToPropertiesFile(File indexDir,
TextIndexConfig config) {
Review Comment:
Add javadoc to public methods.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]