AnsweredAssumed Answered

Ordering is not support for my:property

Question asked by iruizdeeguilaz on Feb 26, 2014
Latest reply on Feb 26, 2014 by iruizdeeguilaz
Hello

I have a problem using ORDER BY with my custom properties. I need help in orther to know what I should change in muy model to allow the order by…

I am able to do queries, and to use my aspect properties in the select…

example:


StringBuffer cadena = new StringBuffer();
cadena.append( "SELECT * FROM my:customtype  as t join my:customaspect as d on d.cmis:objectId = t.cmis:objectId where d.my:dateDocument = TIMESTAMP '"+myDate+"T00:00:00.000-00:00' ");
ItemIterable<QueryResult> results = session.query(cadena.toString(), false);
for (QueryResult qResult : results.skipTo(10).getPage(10)) {
   ———
}


But when I add a order by id doesn't work…. it works if i try it against for example t.cmis:name but it diesn't work againts d.my:…..

Looking up on the Internet I fond that it is necesary tu put in the model something like this (but I put it after having the documents added on the repository)


<index enabled="true">
   <atomic>false</atomic>
   <stored>false</stored>
   <tokenised>true</tokenised>
</index>

I have added it on my model :


<?xml version="1.0" encoding="UTF-8"?>
<model name="my:model" xmlns="http://www.alfresco.org/model/dictionary/1.0">
   <description>my model</description>
   <author>ir</author>
   <version>1.0</version>
   <imports>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
   </imports>
   <namespaces>
      <namespace  uri="dynamic.model" prefix="my" />
   </namespaces>
   <types>
      <type name="my:document">
         <title>my Document</title>
         <parent>cm:content</parent>
         <mandatory-aspects>
            <aspect>my:customaspect</aspect>
         </mandatory-aspects>
      </type>
      <type name="my:customtype">
         <title>my type</title>
         <parent>my:document</parent>
      </type>
</types>   
<aspect name="my:customaspect">
         <title>my Data</title>
         <properties>
            <property name="my:title">
               <type>d:text</type>
               <index enabled="true">
                  <atomic>false</atomic>
                  <stored>false</stored>
                  <tokenised>true</tokenised>
               </index>
            </property>
            <property name="my:dateDocument">
               <type>d:date</type>
               <index enabled="true">
                  <atomic>false</atomic>
                  <stored>false</stored>
                  <tokenised>true</tokenised>
               </index>
            </property>
</properties>
      </aspect>
   </aspects>



this is the error

<blockquote>
Exception in thread "main" org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException: Ordering is not support for d.my:title
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:458)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:629)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.DiscoveryServiceImpl.query(DiscoveryServiceImpl.java:145)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl$3.fetchPage(SessionImpl.java:600)
   at org.apache.chemistry.opencmis.client.runtime.util.AbstractIterator.getCurrentPage(AbstractIterator.java:132)
   at org.apache.chemistry.opencmis.client.runtime.util.CollectionPageIterator.hasNext(CollectionPageIterator.java:48)
   …….
</blockquote>

Outcomes