[rules-users] case in-sensitive string comparison?
We have a requirement to display data as stored (with the right casing) but for evaluation purposes strings should be compared case in-sensitive. We have several hundred rules touching these particular strings and would really like to avoid doing eval( x != null x.equalsIngoreCase(y) ) everywhere. Is there anywhere in drools that we could configure to make string matching case in-sensitive? Since we have to display the data with casing elsewhere, putting x.toLowerCase() in all our getter methods doesn't seem to be an option. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/case-in-sensitive-string-comparison-tp1842677p1842677.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] case in-sensitive string comparison?
You could look at using your own custom operator. Wolfgang Laun linked to an article of his recently explaining the approach. I'm not sure if custom operators however allow for indexing in the RETE network and therefore whether they're any faster than eval. Wolfgang, Edson, can you advise in your experience? Thanks, Mike On 4 November 2010 16:04, H.C. canterbu...@gmail.com wrote: We have a requirement to display data as stored (with the right casing) but for evaluation purposes strings should be compared case in-sensitive. We have several hundred rules touching these particular strings and would really like to avoid doing eval( x != null x.equalsIngoreCase(y) ) everywhere. Is there anywhere in drools that we could configure to make string matching case in-sensitive? Since we have to display the data with casing elsewhere, putting x.toLowerCase() in all our getter methods doesn't seem to be an option. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/case-in-sensitive-string-comparison-tp1842677p1842677.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] case in-sensitive string comparison?
If (re)writing the rules to replace String == and != with a custom op for String eq and ne is an option, then it's simple to provide this operator. The link is http://members.inode.at/w.laun/drools/CustomOperatorHowTo.html -W 2010/11/4 Michael Anstis michael.ans...@gmail.com You could look at using your own custom operator. Wolfgang Laun linked to an article of his recently explaining the approach. I'm not sure if custom operators however allow for indexing in the RETE network and therefore whether they're any faster than eval. Wolfgang, Edson, can you advise in your experience? Thanks, Mike On 4 November 2010 16:04, H.C. canterbu...@gmail.com wrote: We have a requirement to display data as stored (with the right casing) but for evaluation purposes strings should be compared case in-sensitive. We have several hundred rules touching these particular strings and would really like to avoid doing eval( x != null x.equalsIngoreCase(y) ) everywhere. Is there anywhere in drools that we could configure to make string matching case in-sensitive? Since we have to display the data with casing elsewhere, putting x.toLowerCase() in all our getter methods doesn't seem to be an option. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/case-in-sensitive-string-comparison-tp1842677p1842677.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] case in-sensitive string comparison?
Thanks guys, this could be a workable option. Will do some experimentation. Thanks! -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/case-in-sensitive-string-comparison-tp1842677p1843097.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users