Apply limit and offset after combining the relationships when the Content API gets multiple related/ values
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 38/100
Hướng nghiên cứu
Start in ContentResource#getContent, where a related/ value with several relationships runs one query per relationship with the same limit and offset, then intersects the results. Reproduce with the steps in the issue, then check whether limit and offset can be applied once to the combined, sorted result. Done means the multi-relationship call returns old in the example, paging is correct, and an integration test covers the case.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem Statement
A Content API call with more than one value in related/ returns too few results, or an empty list, when either relationship has more matching items than limit. The item matches every requested relationship and should be returned.
ContentResource#getContent handles related/A,B by running one query per relationship, each with the same limit and offset, and then keeping the items present in all of the lists. Each list is cut to the page size before the lists are intersected. An item that is not in the newest limit items of one relationship is dropped, even if it is the only item matching all the relationships. offset paging is broken the same way.
It fails silently: HTTP 200, an empty list, nothing in the log. Newer content added to a relationship can make an unchanged, published item disappear from the response. Re-saving or republishing the item moves it back up the modDate order, which looks like a fix but is temporary.
The Content API documentation ("Content API Retrieval and Querying") describes related/ with two fields as returning the content related to both, and limit as how many results are returned. The code comment on the intersection also says it filters the intersection.
Impact: every REST call that passes more than one related/ value is exposed. First seen on a self-hosted 25.07.10 LTS site.
Not an upgrade regression: the same logic is in 24.12.27 LTS and 25.07.10 LTS (and on main).
Suggested approach: apply limit and offset once, after combining the relationships. Either build a single query with all the relationship terms, or fetch each relationship unbounded, intersect, sort, then page.
Workaround: put the relationship terms in the Lucene query instead of related/, e.g. +Article.author:<id> +Article.topic:<id>.
Steps to Reproduce
https://drive.google.com/file/d/13E8TB1q8LHHcEQu-1qdRU2xttZd_joP1/view?usp=drive_link
- Create content types
AuthorandTopic(a title each) andArticle(a title plus two many-to-many relationship fields,authortoAuthorandtopictoTopic). - Create and publish two Authors (A1, A2) and one Topic (T1).
- Create and publish one Article,
old, related to A1 and T1. - Create and publish 25 more Articles, newer than
old, each related to A2 and T1. - Call (anonymous):
/api/content/render/false/query/+contentType:Article +live:true +languageId:1/limit/20/offset/0/orderBy/modDate desc/language/1/depth/0/related/Article.author:<A1>,Article.topic:<T1> - Expected: 1 result (
old). Actual: 0 results. - For comparison (same data):
- the same call with
limit/100returnsold - only
related/Article.author:<A1>withlimit/20returnsold - only
related/Article.topic:<T1>withlimit/20returns 20 items, not includingold - no
related/, with+Article.author:<A1> +Article.topic:<T1>in the query andlimit/20, returnsold
- the same call with
- Republish
old, then repeat step 5: it returnsold(itsmodDateis now the newest). It breaks again once 20 newer items share T1.
Acceptance Criteria
- A call with several
related/values returns every item related to all of them, up tolimit, regardless of how many items each relationship has -
limitandoffsetapply once, to the combined and sorted result, so paging is correct - An integration test covers an item that matches two relationships while one relationship has more than
limitnewer items - The Content API documentation states how
limitandoffsetbehave with multiplerelated/values
dotCMS Version
Reproduced on 25.07.10 LTS (v9) and 24.12.27 LTS (v2); same code on main.
Severity
Medium - Some functionality impacted
Links
- Ngôn ngữ chính
- Java
- Star
- 972
- Fork
- 493
- Merge trung bình
- 2 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 228
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của dotCMS/core
-
dotCMS : UVE OKR : Customer Support Team : Maintenance Type : Defect
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 2 ngày
-
OKR : Customer Support Team : Maintenance Type : Defect
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Opening content from Content Search replaces the "Search" breadcrumb in the new Edit Content screenĐang mởdotCMS: New Edit Contentlet OKR : Customer Support Team : Falcon Type : Defect
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Escape the Binary field hint in the legacy content editor so an apostrophe doesn't break the fieldĐang mởOKR : Customer Support Team : Maintenance Type : Defect
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 2 ngày
-
dotCMS : Permissions OKR : Customer Support Team : Maintenance Type : Defect
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 2 ngày
Issue tương tự
-
desktop grp:about type:graphics-bug ui-public
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 2 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
it-at-m/Wahllokalsystem#3846 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Area/Connector module/solace Priority/Low Type/Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
ballerina-platform/ballerina-library#9849 ·
Maintainer thường phản hồi trong vòng 1 ngày