Alfresco Pagination Basic concept

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Active Member

Alfresco Pagination Basic concept

Hi All,

I am using alfresco-5.0.d and solr4.I have implemented pagination in my application with this code.

PagingRequest paging=new PagingRequest(skipResult,maxResult);

 List<Pair<QName, Boolean>> sortProps = new ArrayList<Pair<QName,
 Boolean>>();      sortProps.add(new Pair<QName,
 Boolean>(ContentModel.PROP_NAME, true));

 PagingResults<FileInfo> folderContentList =
 filefolderService.list(nodeRef,true,true,null,sortProps,paging);

I am getting the result based on creation date
It seems alfresco is giving result based on creation date after that it's apply sorting.

please tell me how can i get the result based on prop_name

4 Replies
Highlighted
Master

Re: Alfresco Pagination Basic concept

SOLR4 is not relevant for your use case as the FileFolderService uses database queries for data retrieval. The list operation retrieves the children of the folder in the order they are provided by the database (not necessarily the same as the creation date) and only performs an in-memory sort. If you do not specify a specific sort order, it will use the order in which the items have been added to the folder (which also is not necessarily the same as the creation date, e.g. when an item was moved into a folder long after it was created).

As an alternative to FileFolderService.list() you can also do an FTS query against the database using the Transactional Metadata Query feature added with Alfresco 4.2. A FTS query will apply the sort condition immediately within the SQL select statement. The same also applies if you use SOLR4 for this type of query (e.g. if you request the query to use EVENTUAL consistency or your database has not been prepared for Transactional Metadata Queries).

Highlighted
Active Member

Re: Alfresco Pagination Basic concept

Thanks to quick reply @Axel Faust

I am completely agree with your answer.But i need to use pagination also .So for that i want alfresco to first get all result, sort the result based on sortProps and then revert the result.but it seems first alfresco getting the result based on my paging request and then performing sort then reverting.

Highlighted
Master

Re: Alfresco Pagination Basic concept

Search also has pagination support...

Highlighted
Active Member

Re: Alfresco Pagination Basic concept

but that will reduce the performance it seems.Suppose there is 1k records in a folder so getting page by page is faster then getting all data using fts query and then sort