AnsweredAssumed Answered

Sort using SearchParameters

Question asked by kmehta31@yahoo.com on Jan 13, 2009
Latest reply on Jan 14, 2009 by kmehta31@yahoo.com
Hi all,

We are having web form for creating Divisions. In my webscript I iterate our all the webforms using following query:

SearchParameters sp = new SearchParameters();         
sp.addStore(getStoreReference());         
sp.setLanguage(SearchService.LANGUAGE_LUCENE);

StringBuffer strBfrQuery = new StringBuffer();
strBfrQuery.append("@\\{http\\://www.alfresco.org/model/wcmappmodel/1.0\\}parentformname:\'Division\"");
sp.setQuery(strBfrQuery.toString());

String strQname = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "title").toString();
sp.addSort(strQname, true);

I am expecting the resultset to return the sorted results on Title. But its giving random results that are not sorted.

I also tried sorting based on division name which is one of the property we index out of the Webform
If I add following line it gives null pointer exception
sp.addSort("@"+"{http://www.nbc.com/model/wcm/mediavillage/1.0}divisonName',true);

And if I add following line

sp.addSort("{http://www.nbc.com/model/wcm/mediavillage/1.0}divisonName',true); It gives me same defult order. Means not what I m expecting the sort on divisionName.

Neither of this is working fine.

Can anyone help me out in this to understand what m i doing wrong. M i missing anything…

Thanking you in andvance.

Outcomes