Details
-
Bug
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
None
-
None
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