Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-2671

Allow relational operators for String

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 5.4.0.Beta1
    • 5.1.0.FINAL
    • drools-core (expert)
    • None

      Currently you cannot use relational operators for String fields. e.g. MyFact(name > "bbb")

      org.drools.base.evaluators.ComparableEvaluatorsDefinition.evaluators has entries for ValueType.OBJECT_TYPE, but not for ValueType.STRING_TYPE. So it results in DescrBuildError:

      =========
      Evaluator '>' does not support type 'ValueType = 'String' : [Rule name='Your First Rule']

      Unable to create restriction '[LiteralRestriction: > bbb]' for field 'name' in the rule 'Your First Rule' : [Rule name='Your First Rule']
      =========

      According to docs:
      4.8.3.1.1.3.1. Operators
      "Other relational operatory may be used whenever the type values are ordered;"

      http://downloads.jboss.com/drools/docs/5.1.0.34406.FINAL/drools-expert/html_single/index.html#RuleLanguage-ConditionalElements

      It is desirable to allow relational operators for String fields as String is Comparable.

              etirelli@redhat.com Edson Tirelli
              rhn-support-tkobayas Toshiya Kobayashi
              Archiver:
              rhn-support-ceverson Clark Everson

                Created:
                Updated:
                Resolved:
                Archived: