Properties not defined on some entities break a result set
- Dominant language
- C++
- Stars
- 93
- Forks
- 34
- PR merge metrics
- No merged PRs in 30d
Description
Using search criteria to search for entities where one of them does not have the property we search for gives an error message:
```
db.query([{'AddEntity': {'class': 'Test', 'properties': {'x': 1}}}])
Out[4]: ([{'AddEntity': {'info': '', 'status': 0}}], [])
db.query([{'AddEntity': {'class': 'Test', 'properties': {'x': 2}}}])
Out[5]: ([{'AddEntity': {'info': '', 'status': 0}}], [])
db.query([{'AddEntity': {'class': 'Test'}}])
Out[6]: ([{'AddEntity': {'info': '', 'status': 0}}], [])
db.query([{"FindEntity": {'class': 'Test', 'constraints': {'x': ['==', 1]}}}])
Out[7]:
([{'FindEntity': {'info': 'Unknown operation type for query\n',
'status': -1}}],
[])
```
Simply listing them does work:
```
db.query([{"FindEntity": {'class': 'Test', 'results': {'list': ['x']}}}])
Out[12]:
([{'FindEntity': {'entities': [{'x': 'Missing property'}, {'x': 2}, {'x': 1}],
'returned': 3,
'status': 0}}],
[])
```
but only if the results are not sorted:
```
db.query([{"FindEntity": {'class': 'Test', 'results': {'list': ['x'], 'sort': 'x'}}}])
Out[14]:
([{'FailedCommand': 'Transaction',
'info': 'Failed PMGDTransaction',
'status': -1}],
[])
```
Contributor guide
Assessment
This issue has not been assessed yet.