Uploaded image for project: 'Hippo CMS'
  1. Hippo CMS
  2. CMS-9350

Can't create constraint to match emptystring property value

    XMLWordPrintable

Details

    Description

      I'm trying to implement an Advanced Search filter [1]. The filter is meant to quickly pull up all documents that have a non-empty value in certain fields, for example myhippoproject:title.

      I'm not able to get a constraint that works. I've tried:

      TextConstraint titleEmpty = QueryUtils.text("myhippoproject:title").isEqualTo("");

      but this results in a broken xpath query containing

      (@myhippoprojct:title = )

      Using

      final Constraint titleEmpty = QueryUtils.text("myhippoproject:title").exists();

      results in

      (@myhippoproject:title)

      Which is great if you want to see if the property is set on the node at all, but doesn't help if the property is an emptystring. And also

      TextConstraint titleEmpty = QueryUtils.text("myhippoproject:title").isEqualTo("''");

      but this results in an xpath query containing four ' characters

      (@myhippoprojct:title = '''')

      What I need is to create (@myhippoprojct:title = '')

      I think

      TextConstraint titleEmpty = QueryUtils.text("myhippoproject:title").isEqualTo("");

      should generate this instead of What I need is to create (@myhippoprojct:title =)

      [1] - http://www.onehippo.org/library/enterprise/enterprise-features/advanced-search/advanced-search.html

      Attachments

        Activity

          People

            wborgbarthet William Borg Barthet
            wborgbarthet William Borg Barthet
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: