Collection @id field is not unique.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 109
- Forks
- 107
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 4
Description
While querying for items in the site, I ended up with duplicate @ids. I found out that apparently the global querystring endpoint is returned as the @id for Collections, instead of the url.
Here is the api query i tried. I sent a POST to http://localhost:8080/Plone2/@querystring-search with the following body:
{
"query": [
{
"i": "path",
"o": "plone.app.querystring.operation.string.relativePath",
"v": "."
},
{
"i": "portal_type",
"o": "plone.app.querystring.operation.selection.any",
"v": "Collection"
}
],
"fullobjects": 1
}
And this is the response I got:
{
"@id": "http://localhost:8080/Plone2/@querystring-search",
"items": [
{
"@components": {
"actions": {
"@id": "http://localhost:8080/Plone2/news/aggregator/@actions"
},
"breadcrumbs": {
"@id": "http://localhost:8080/Plone2/news/aggregator/@breadcrumbs"
},
"navigation": {
"@id": "http://localhost:8080/Plone2/news/aggregator/@navigation"
},
"types": {
"@id": "http://localhost:8080/Plone2/news/aggregator/@types"
},
"workflow": {
"@id": "http://localhost:8080/Plone2/news/aggregator/@workflow"
}
},
"@id": "http://localhost:8080/Plone2/@querystring-search",
"@type": "Collection",
"UID": "5652964873654ed58c6989036c1d096c",
"allow_discussion": false,
"contributors": [],
"created": "2020-01-10T11:46:26+00:00",
"creators": [
"admin"
],
"customViewFields": [
{
"title": "Title",
"token": "Title"
},
{
"title": "Creator",
"token": "Creator"
},
{
"title": "Type",
"token": "Type"
},
{
"title": "ModificationDate",
"token": "ModificationDate"
}
],
"description": "Notizie del sito",
"effective": null,
"exclude_from_nav": false,
"expires": null,
"id": "aggregator",
"is_folderish": false,
"item_count": 30,
"items": [],
"items_total": 0,
"language": "",
"layout": "summary_view",
"limit": 1000,
"modified": "2020-01-10T11:46:26+00:00",
"parent": {
"@id": "http://localhost:8080/Plone2/news",
"@type": "Folder",
"description": "Notizie del sito",
"review_state": "published",
"title": "Notizie"
},
"query": [
{
"i": "portal_type",
"o": "plone.app.querystring.operation.selection.any",
"v": [
"News Item"
]
},
{
"i": "review_state",
"o": "plone.app.querystring.operation.selection.any",
"v": [
"published"
]
}
],
"relatedItems": [],
"review_state": "published",
"rights": "",
"sort_on": "effective",
"sort_reversed": true,
"subjects": [],
"text": null,
"title": "Notizie",
"version": "current"
},
{
"@components": {
"actions": {
"@id": "http://localhost:8080/Plone2/events/aggregator/@actions"
},
"breadcrumbs": {
"@id": "http://localhost:8080/Plone2/events/aggregator/@breadcrumbs"
},
"navigation": {
"@id": "http://localhost:8080/Plone2/events/aggregator/@navigation"
},
"types": {
"@id": "http://localhost:8080/Plone2/events/aggregator/@types"
},
"workflow": {
"@id": "http://localhost:8080/Plone2/events/aggregator/@workflow"
}
},
"@id": "http://localhost:8080/Plone2/@querystring-search",
"@type": "Collection",
"UID": "743e2066df7044b88bee59c491d796cf",
"allow_discussion": false,
"contributors": [],
"created": "2020-01-10T11:46:27+00:00",
"creators": [
"admin"
],
"customViewFields": [
{
"title": "Title",
"token": "Title"
},
{
"title": "Creator",
"token": "Creator"
},
{
"title": "Type",
"token": "Type"
},
{
"title": "ModificationDate",
"token": "ModificationDate"
}
],
"description": "Eventi del sito",
"effective": null,
"exclude_from_nav": false,
"expires": null,
"id": "aggregator",
"is_folderish": false,
"item_count": 30,
"items": [],
"items_total": 0,
"language": "",
"layout": "event_listing",
"limit": 1000,
"modified": "2020-01-10T11:46:27+00:00",
"parent": {
"@id": "http://localhost:8080/Plone2/events",
"@type": "Folder",
"description": "Eventi del sito",
"review_state": "published",
"title": "Eventi"
},
"query": [
{
"i": "portal_type",
"o": "plone.app.querystring.operation.selection.any",
"v": [
"Event"
]
},
{
"i": "review_state",
"o": "plone.app.querystring.operation.selection.any",
"v": [
"published"
]
}
],
"relatedItems": [],
"review_state": "published",
"rights": "",
"sort_on": "start",
"sort_reversed": true,
"subjects": [],
"text": null,
"title": "Eventi",
"version": "current"
}
],
"items_total": 2
}
Both results have the same @id. If I remove fullobjects the response contains the actual collection url in the @id field.
This is a fresh Plone site with just restapi installed, running on the latest Plone 5.2.1-pending with plone.restapi 6.1.0.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the POST to the @querystring-search endpoint with the issue's query and compare responses with and without fullobjects. Trace how Collection results receive their @id values; done means fullobjects responses use each collection's actual URL rather than the shared query endpoint, with distinct @id values for both results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100