cancel
Showing results for 
Search instead for 
Did you mean: 

"=" and "IN" operators doesn't work in CMIS query

aminebarbare
Champ in-the-making
Champ in-the-making

Hi guys,

I defined an aspect where the "typeDocument" property is defined :

<?xml version="1.0" encoding="UTF-8"?>

<!-- Definition of new Model -->

<model name="idoc:ideodocModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

<!-- Optional meta-data about the model -->

<description>IdeoDoc Model</description>

<author>MERIEM BENSAID</author>

<version>1.0</version>

<!-- Imports are required to allow references to definitions in other models -->

<imports>

<!-- Import Alfresco Dictionary Definitions -->

<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
<!-- Import Alfresco Content Domain Model Definitions -->

<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />

</imports>

<namespaces>

<namespace uri="http://sante.documentaire.sqli.com/model/content/1.0" prefix="idoc" />
</namespaces>

<aspects>

<aspect name="idoc:typeDocument">

<title>Type du document</title>

<properties>

<property name="idoc:idTypedocument">

<title>identifiant du type</title>

<type>d:text</type>

<multiple>false</multiple>

</property>

<property name="idoc:libelleTypeDocument">

<title>Libellé du type</title>

<type>d:text</type>

<multiple>false</multiple>

</property>

</properties>

</aspect>

</aspects>

</model>

So I'm trying to execute the following query to get documents with "idTypedocument" equals to 9, but this query gets nothing.

SELECT * FROM vig:content content JOIN idoc:typeDocument typeDoc ON content.cmis:objectId = typeDoc.cmis:objectId WHERE content.cmis:objectId is not null  AND typeDoc.idoc:idTypedocument = '9'

However when i execute tthe following query I get the results I want.

SELECT * FROM vig:content content JOIN idoc:typeDocument typeDoc ON content.cmis:objectId = typeDoc.cmis:objectId WHERE content.cmis:objectId is not null  AND typeDoc.idoc:idTypedocument <= '9' AND typeDoc.idoc:idTypedocument >= '9'

The problem is that i'm only replacing the "=" operator with "<= AND >=" operators.
The type of the "idTypedocument" attribute is String and i'm using the version : (Version :Community - v4.2.0 (r63893-b12))

So am I forgetting something in the aspect/property definition?

Thanks in advance.

PS: the same problem with "IN" operator.

1 ACCEPTED ANSWER

jpotts
World-Class Innovator
World-Class Innovator

You cannot do those comparisons against a string, according to the CMIS spec. When comparing strings, you may only use "=, <>, [NOT] LIKE".

View answer in original post

10 REPLIES 10

aminebarbare
Champ in-the-making
Champ in-the-making

I'm sorry, I forgot to mention that the operators work just fine with the alfresco built in properties like the "title", that's why i asked if i am forgetting something in the aspect/property definition.