cancel
Showing results for 
Search instead for 
Did you mean: 

Ordering is not support for my:property

iruizdeeguilaz
Champ in-the-making
Champ in-the-making
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>
2 REPLIES 2

kaynezhang
World-Class Innovator
World-Class Innovator
a property is sortable  only if it is untokenized,so it must be defined as

<tokenised>false</tokenised>
or
<tokenised>both</tokenised>

iruizdeeguilaz
Champ in-the-making
Champ in-the-making
yes, it worked, I chose both in order to check it and I am able to order Smiley Happy))))

thanks so much