rahulgoswami commented on code in PR #1816:
URL: https://github.com/apache/solr/pull/1816#discussion_r1285342351
##########
solr/core/src/java/org/apache/solr/schema/BoolField.java:
##########
@@ -211,7 +212,7 @@ public List<IndexableField> createFields(SchemaField field,
Object value) {
@Override
public Object toNativeType(Object val) {
if (val instanceof CharSequence) {
- return Boolean.valueOf(val.toString());
+ return Boolean.valueOf(StrUtils.parseBoolean(val.toString()));
Review Comment:
Thanks for pointing out the change in toInternal(). Makes sense.
About the parameter type change in StrUtils.parseBoolean() to CharSeqeunce,
is there a performance gain to be achieved there? With the proposed change, I'd
have to typecast val to CharSequence while calling parseBoolean() inside
toNativeType(). Alterntively, calling val.toString() should not have any
overhead either since val would already be a String and the String class
toString() implementation simply returns "this" anyway, so there is no extra
object creation. We can avoid a change to StrUtils unless I am missing
something. Thoughts welcome.
--
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]