Skip to content

Fix operator precedence in personalized product recommendation query#159

Closed
Copilot wants to merge 2 commits intodevelopfrom
copilot/fix-recommendation-error
Closed

Fix operator precedence in personalized product recommendation query#159
Copilot wants to merge 2 commits intodevelopfrom
copilot/fix-recommendation-error

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 19, 2026

Problem

Missing parentheses in findRecommendedProducts query caused incorrect operator precedence when filtering by price range. The OR condition was binding with only the second AND clause instead of the entire price check expression.

Changes

ProductRepository.java - Fixed JPQL query on line 233:

// Before: AND binds tighter than OR, breaking the logic
"  OR (p.discountPrice IS NULL OR p.discountPrice = 0) AND p.price BETWEEN :minPrice AND :maxPrice"

// After: Properly grouped OR clause
"  OR ((p.discountPrice IS NULL OR p.discountPrice = 0) AND p.price BETWEEN :minPrice AND :maxPrice)"

This aligns with the pattern already used in findAllByCondition and findAllByParentCategoryCondition queries in the same file.

Impact

Personalized recommendations for logged-in users now correctly filter products within the ±10,000원 price range, regardless of whether they use discount or regular pricing.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Fix] 추천 상품 오류</issue_title>
<issue_description>## 📌 Description

[Fix] 추천 상품 오류

✅ To-do

  • 진행 예정
  • 진행 완료

📒 기타</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: neibler <87866961+neibler@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix recommendation product error Fix operator precedence in personalized product recommendation query Feb 19, 2026
Copilot AI requested a review from neibler February 19, 2026 10:18
@neibler neibler closed this Feb 19, 2026
@neibler neibler reopened this Feb 19, 2026
@neibler neibler closed this Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactor] 홈화면 상품 응답 통일

2 participants