AnsweredAssumed Answered

search and sort by property multiple

Question asked by jclandron on Mar 24, 2011
Hi all !

Here the model

<aspect name="mn:useful">
     <title>useful document</title>
     <properties>
          <property name="mn:username">
               <title>username</title>
               <type>d:string</type>
               <multiple>true</multiple> 
          </property>
     </properties>
</aspect>
<type name="mn:document">
     <title>Document</title>
     <parent>cm:content</parent>
     <properties>
     </properties>
     <mandatory-aspects>
          <aspect>mn:useful</aspect>
     </mandatory-aspects>
</type>

Source code to search and sort by name :
     String req = "PARENT:\"workspace://SpacesStore/b19b7e85-a273-449b-a90f-a5fabfbc1e99\";
     String sortAttr = "@cm:name";
     SearchParameters searchParameters = new SearchParameters();
     searchParameters.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
     searchParameters.setLanguage(SearchService.LANGUAGE_LUCENE);
     searchParameters.addSort(sortAttr, true);
     searchParameters.setQuery(req);
     ResultSet results = this.searchService.query(searchParameters);
     liste = results.getNodeRefs();
     results.close();

Is there a way to sort the list by the sum of people who think the document useful ?

Thanks a lot

jclandron

Outcomes