Wrong pagination results since uprade to v7.2.1

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

Wrong pagination results since uprade to v7.2.1

Jump to solution

Hello everyone,

We've came across a pagination problem since we've upgrade Alfresco to v7.2.1.

I'm using the Search API with this body:

{
  "query": {
    "language": "cmis",
    "query": "select * from cmis:document where in_folder('fc896c39-b13b-493a-bdeb-9152d8495dd0')"
  },
  "fields": ["id"],
  "paging": {
    "maxItems": 1,
    "skipCount": 0
  }
}

 

I have 3 files in this directory and the pagination results are wrong, here is the response : 

{  
"list": {
"pagination": {
"count": 1,
"hasMoreItems": true,
"totalItems": 2,
"skipCount": 0,
"maxItems": 1 }, "entries": [
{ "entry": {
"id": "7149284e-7422-4f55-b16e-63a8cd61fa76" } } ] } }

 The fields totalItems says 2 but i have 3 files.

Does somebody ever came across this behavior ?

Thanks.

1 Solution

Accepted Solutions
tovski
Active Member

Re: Wrong pagination results since uprade to v7.2.1

Jump to solution

Thanks for your reply,

I did some digging and i found a bug report on jira

 https://alfresco.atlassian.net/browse/MNT-22988?focusedCommentId=1120337 

see also for more explanation : https://alfresco.atlassian.net/browse/MNT-22385?focusedCommentId=1087195 

It seams that "this is not a bug"... but an expected behavour related to permissions check.

The "solution" i found is to use IN_TREE in replacement of IN_FOLDER to force the query to be executed on SOLR.

EDIT: I found an other solution, it's possible to increase the max permissions check number in the query body with the property "limits".

 

    "query": {
        "query": "SELECT * FROM cmis:document WHERE IN_FOLDER('fc896c39-b13b-493a-bdeb-9152d8495dd0')",
        "language": "cmis"
    },
    "fields": [
        "id"
    ],
    "paging": {
        "maxItems": 1,
        "skipCount": 0
    },
    "limits": {
        "permissionEvaluationCount": 10000
    }

View solution in original post

10 Replies
sanjaybandhniya
Intermediate

Re: Wrong pagination results since uprade to v7.2.1

Jump to solution

Could you check same query in alfresco node browser and check result?

tovski
Active Member

Re: Wrong pagination results since uprade to v7.2.1

Jump to solution

Thank you for your reply.

I tried the cmis request on the node explorer and the results and pagination seems correct (3 results).

But the problem i have is with the pagination infos, the number of items are correct bu not the pagination info (totalItems).

It happens when i set the field "maxItems" to 1 and "skipCount" to 0 (i want only one file in the response but with pagination info).

The cmis query i'm using is mainly for retrieving the number of files in a directory, that's why i want only one file, because i'm only interested in the pagination results to have the field totalItems.

I've also tried the API /nodes/{nodeId}/children, the pagination info is correct, so is it a problem with the search api ?

 

tovski
Active Member

Re: Wrong pagination results since uprade to v7.2.1

Jump to solution

I'm still looking for help.

robinp
Partner

Re: Wrong pagination results since uprade to v7.2.1

Jump to solution

Why not using a lucene/AFTS query with PARENT:"yourparentnode" ??

robinp
Partner

Re: Wrong pagination results since uprade to v7.2.1

Jump to solution

Also, maybe is it possible that your third node is not a cmis:document ?

tovski
Active Member

Re: Wrong pagination results since uprade to v7.2.1

Jump to solution

Hi, thanks for your reply.

We can't use AFTS because our project is developed around CMIS. But i can try just for debugging

Yes my third node is a cmis:document

alecorff
Partner

Re: Wrong pagination results since uprade to v7.2.1

Jump to solution

Hi, 

Have you found any solution ? Like overriding the SearchApiWebscript.class maybe ?

 

 

tovski
Active Member

Re: Wrong pagination results since uprade to v7.2.1

Jump to solution

Hi,

I'm still looking for a solution.

I don't know where i can find the file SearchApiWebscript.class and unfortunately i don't have many options regarding the configuration of alfresco because it is managed by a business client.

I would like to know if it is bug of the v7.2.1 or if we did something wrong while upgrading from the previous version (aflresco v6).

alecorff
Partner

Re: Wrong pagination results since uprade to v7.2.1

Jump to solution

Hi,

I think it's a bug from v7.2.1 as I reproduce the issue in business client environment.

I duplicate the search api webscript and create a new CustomSearchApiWebscript.java where I only add a line to calculate the right totalItems. As far as I test, it seems to work.

I now need to call https://<serverName>/alfresco/s/customSearchApiWS