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

        1. overridden.xml
          0.6 kB
          William Borg Barthet
        2. OverriddenDocumentsPlugin.html
          1 kB
          William Borg Barthet
        3. OverriddenDocumentsPlugin.java
          2 kB
          William Borg Barthet

        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: