diff --git a/config/alfresco/ibatis/org.hibernate.dialect.Dialect/metadata-query-common-SqlMap.xml b/config/alfresco/ibatis/org.hibernate.dialect.Dialect/metadata-query-common-SqlMap.xml
index cceaeb6cd3..d66e82a93b 100644
--- a/config/alfresco/ibatis/org.hibernate.dialect.Dialect/metadata-query-common-SqlMap.xml
+++ b/config/alfresco/ibatis/org.hibernate.dialect.Dialect/metadata-query-common-SqlMap.xml
@@ -74,7 +74,14 @@
(
- node.id IN (
+
+
+ node.id NOT IN (
+
+
+ node.id IN (
+
+
@@ -108,7 +115,7 @@
${item.alias}.${item.fieldName} IS NOT NULL
- ${item.alias}.${item.fieldName} IS NULL
+ ${item.alias}.${item.fieldName} IS NOT NULL
${item.fieldAndFunction} > #{item.value}
diff --git a/source/test-java/org/alfresco/opencmis/search/OpenCmisQueryTest.java b/source/test-java/org/alfresco/opencmis/search/OpenCmisQueryTest.java
index 48f42893dc..57c0bcb96f 100644
--- a/source/test-java/org/alfresco/opencmis/search/OpenCmisQueryTest.java
+++ b/source/test-java/org/alfresco/opencmis/search/OpenCmisQueryTest.java
@@ -5738,6 +5738,21 @@ public class OpenCmisQueryTest extends BaseCMISTest
testQuery("SELECT * FROM cm:ownable ", 0, false, "cmis:name", new String(), true);
testExtendedQuery("SELECT * FROM cm:ownable ", 1, false, "cmis:name", new String(), false);
}
+
+ public void testTitled() throws Exception
+ {
+ testExtendedQuery("SELECT * FROM cm:titled where cm:title is null ", 0, false, "cmis:name", new String(), false);
+ testExtendedQuery("SELECT * FROM cm:titled where cm:title is not null ", 11, false, "cmis:name", new String(), false);
+ nodeService.setProperty(c10, ContentModel.PROP_TITLE, null);
+ testExtendedQuery("SELECT * FROM cm:titled where cm:title is null ", 1, false, "cmis:name", new String(), false);
+ testExtendedQuery("SELECT * FROM cm:titled where cm:title is not null ", 10, false, "cmis:name", new String(), false);
+ nodeService.setProperty(c10, ContentModel.PROP_TITLE, "meep");
+ testExtendedQuery("SELECT * FROM cm:titled where cm:title is null ", 0, false, "cmis:name", new String(), false);
+ testExtendedQuery("SELECT * FROM cm:titled where cm:title is not null ", 11, false, "cmis:name", new String(), false);
+ nodeService.removeProperty(c10, ContentModel.PROP_TITLE);
+ testExtendedQuery("SELECT * FROM cm:titled where cm:title is null ", 1, false, "cmis:name", new String(), false);
+ testExtendedQuery("SELECT * FROM cm:titled where cm:title is not null ", 10, false, "cmis:name", new String(), false);
+ }
public void testNotKeyword() throws Exception
{