Ticket #893 (closed Defect: fixed)

Opened 9 years ago

Last modified 9 years ago

miscounting workspaces

Reported by: JuergeN Owned by: jri
Priority: Major Milestone: Release 4.8
Component: DeepaMehta Standard Distribution Version: 4.7
Keywords: Cc:
Complexity: 3 Area:
Module:

Description

When as admin I get the list of workspaces, the total_count result is not matching the result list of /core/topic/by_type/dm4.workspaces.workspace:

{
   "items": [
      {
         "assoc": {
            "childs": {}, 
            "id": 2345, 
            "role_1": {
               "role_type_uri": "dm4.core.instance", 
               "topic_id": 2337
            }, 
            "role_2": {
               "role_type_uri": "dm4.core.type", 
               "topic_id": 2245
            }, 
            "type_uri": "dm4.core.instantiation", 
            "uri": "", 
            "value": ""
         }, 
         "childs": {
            "dm4.time.created": {
               "childs": {}, 
               "id": -1, 
               "type_uri": "dm4.time.created", 
               "uri": "", 
               "value": 1448070559688
            }, 
            "dm4.time.modified": {
               "childs": {}, 
               "id": -1, 
               "type_uri": "dm4.time.modified", 
               "uri": "", 
               "value": 1448070559688
            }
         }, 
         "id": 2337, 
         "type_uri": "dm4.workspaces.workspace", 
         "uri": "dm4.workspaces.deepamehta", 
         "value": "DeepaMehta"
      }, 
      {
         "assoc": {
            "childs": {}, 
            "id": 3018, 
            "role_1": {
               "role_type_uri": "dm4.core.instance", 
               "topic_id": 3010
            }, 
            "role_2": {
               "role_type_uri": "dm4.core.type", 
               "topic_id": 2245
            }, 
            "type_uri": "dm4.core.instantiation", 
            "uri": "", 
            "value": ""
         }, 
         "childs": {
            "dm4.time.created": {
               "childs": {}, 
               "id": -1, 
               "type_uri": "dm4.time.created", 
               "uri": "", 
               "value": 1448070562613
            }, 
            "dm4.time.modified": {
               "childs": {}, 
               "id": -1, 
               "type_uri": "dm4.time.modified", 
               "uri": "", 
               "value": 1448070562613
            }
         }, 
         "id": 3010, 
         "type_uri": "dm4.workspaces.workspace", 
         "uri": "", 
         "value": "Private Workspace"
      }, 
      {
         "assoc": {
            "childs": {}, 
            "id": 2920, 
            "role_1": {
               "role_type_uri": "dm4.core.instance", 
               "topic_id": 2912
            }, 
            "role_2": {
               "role_type_uri": "dm4.core.type", 
               "topic_id": 2245
            }, 
            "type_uri": "dm4.core.instantiation", 
            "uri": "", 
            "value": ""
         }, 
         "childs": {
            "dm4.time.created": {
               "childs": {}, 
               "id": -1, 
               "type_uri": "dm4.time.created", 
               "uri": "", 
               "value": 1448070562436
            }, 
            "dm4.time.modified": {
               "childs": {}, 
               "id": -1, 
               "type_uri": "dm4.time.modified", 
               "uri": "", 
               "value": 1448070562436
            }
         }, 
         "id": 2912, 
         "type_uri": "dm4.workspaces.workspace", 
         "uri": "dm4.workspaces.system", 
         "value": "System"
      }
   ], 
   "total_count": 4
} 

I think this is because total_count does not reflect the acl and also counts e.g. the _other_ users private workspace which is not reflected in the result list.

Change History

comment:1 Changed 9 years ago by jri

Yes indeed, total_count reflects the number of items before access control is applied.

At the moment total_count is an obsolete property. Don't rely on it.

To get the actual result size inspect the length of the items array.

Originally total_count was used in conjunction with result limiting. Most of the Core API (and REST API) retrieval calls take a maxResultSize parameter. So you could ask e.g. for the first 50 items (and thus getting a 50-item arry) while total_count tells you that there are actually 1300 matching items in the DB.

However, for quite a while result size limiting (resp. a true "paging" feature) is not supported by the Core anymore (see also #885). This is still to be realized in a future release.

comment:2 Changed 9 years ago by JuergeN

OK. I get it. But please either fix it or remove it. Because at the very moment this is totally misleading and it took me quite some time to figure out what is going wrong. Every singe change to the data respresentation requires more work for other people. So lets not take that too easy, please.

comment:3 Changed 9 years ago by jri

Agreed. In 4.7.1 total_count will be removed. See #895.
Sorry for the confusion.

comment:4 Changed 9 years ago by jri

  • Status changed from new to accepted

comment:5 Changed 9 years ago by jri

  • Status changed from accepted to closed
  • Resolution set to fixed

4.7.1 was never released.
The fix will be in 4.8

Note: See TracTickets for help on using tickets.