Search code examples
fiware-orion

Why Orion as a ContextProvider is returning default 20 entities in case of 'registration using idPattern'


Currently Orion as a Context Provider is returning default 20 entities in case of registration with idPattern. Please provide your opinion whether the default 20 entities are hardcoded for context provider? If so, Can you please share the code location, from where provider is returning default 20 entities irrespective of limit in API request.

I have followed below steps:

  1. Created 5 entities of Context Broker (A1, A2, A3, A4, A5)
  2. Created 25 entities on Context Provider (i.e. Orion:1027) B101, B102, ... B125.
  3. Registered the CP entities with "idPattern": ".*"
  4. Get the entities with below command:
curl -X GET 'localhost:1026/v2/entities?idPattern=.*&type=T&limit=6'

Getting default 20 entities from CP even requested limit is only 6.


Solution

  • Below is the current scenario in Fiware-Orion (on 04th Jan 2023):

    limit variable is being set in mongoQueryContext.cpp at L#339 by uriParams option i.e. URI_PARAM_PAGINATION_LIMIT variable.

    But in case of request forwarding (i.e. context provider), limit is not forwarded with uriParam, so for that reason, default limit value is being assigned to URI_PARAM_PAGINATION_LIMIT variable in rest.cpp at L#1347.

    And that default value is being used by Limit variable in case of context provider in mongoQueryContext.cpp at L#339.