04-28-2023 02:59 AM
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.
07-07-2023 07:40 AM
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 }
04-30-2023 09:07 PM
Could you check same query in alfresco node browser and check result?
05-02-2023 12:40 AM
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 ?
05-24-2023 01:20 AM
I'm still looking for help.
05-24-2023 03:22 AM
Why not using a lucene/AFTS query with PARENT:"yourparentnode" ??
05-24-2023 03:23 AM
Also, maybe is it possible that your third node is not a cmis:document ?
05-24-2023 08:59 AM
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
06-30-2023 02:11 AM
Hi,
Have you found any solution ? Like overriding the SearchApiWebscript.class maybe ?
07-07-2023 06:34 AM
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).
07-07-2023 06:51 AM
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
Explore our Alfresco products with the links below. Use labels to filter content by product module.