cancel
Showing results for 
Search instead for 
Did you mean: 

How to sort nodes by a specific property in lucene search

shanmugaraja
Champ in-the-making
Champ in-the-making
The following is the lucene query, This fetches a set of nodes. I would like to sort the nodes by a particular property that is the title. Is there a way we coud sort the nodes by a particular property. Any help is highly appriciated.



"( PATH:\"/app:company_home/cm:Business_x0020_Gateway/cm:links//*\" AND ( PATH:\"/cm:categoryRoot/cm:generalclassifiable/cm:Languages//*\" AND PATH:\"/cm:categoryRoot/cm:generalclassifiable/cm:Regions//*\" ) ) AND (( TYPE:\"{http://www.alfresco.org/model/content/1.0}content\"))

I want also fetch the nodes for a particular date,
Is there any way i could filter with a date that is a property for a node?

Thanks in Advance
4 REPLIES 4

kevinr
Star Contributor
Star Contributor
You can only apply a sort if you are using our Java foundation APIs to call Lucene - there is a SearchParameters object that can do this.

You can search on date, we do this in the Advanced Search in the UI - either take a look at the code for the SearchContext class in the web-client project code in the SDK or see this wiki page:
http://wiki.alfresco.com/wiki/Search#Finding_nodes_by_date_and_time_property_values

Thanks,

Kevin

ajv
Champ in-the-making
Champ in-the-making
Hi,

Is posible apply a sort with JavaScript API??
Thanks!

kevinr
Star Contributor
Star Contributor
No not at present - we should add that it would be easy to do, so I have raise an JIRA item for it:
http://issues.alfresco.com/browse/AR-1825

Thanks,

Kevin

putodemonio
Champ in-the-making
Champ in-the-making
Hi!

I'm using Alfresco Webservices API's repository service.


RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService();         
String strQuery="";

// strQuery += … …

Query query = new Query(Constants.QUERY_LANG_LUCENE, strQuery);
QueryResult rootChildren = repositoryService.query(STORE, query, false);
ResultSet rootChildrenResults = rootChildren.getResultSet();
ResultSetRow[] rows = rootChildrenResults.getRows();

How can I sort the results of my querys??

Thank you very much!