-
Notifications
You must be signed in to change notification settings - Fork 0
Develop #118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Develop #118
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -111,17 +111,12 @@ public String getNearbyPopularStoresForAi(ToolContext toolContext) { | |||||
| .collect(Collectors.joining("\n")); | ||||||
| } | ||||||
|
|
||||||
| // λ΄ μ£Όλ³ λ§€μ₯ (λ°μ΄λ©λ°μ€ μ νν° + 거리 μ λ ¬) | ||||||
| // λ΄ μ£Όλ³ λ§€μ₯ (PostGIS GIST μΈλ±μ€ + ST_DWithin + KNN 거리 μ λ ¬) | ||||||
| @Transactional(readOnly = true) | ||||||
| public List<StoreListResponse> getNearbyStores(double latitude, double longitude, int page, int size) { | ||||||
| int limitedSize = Math.min(size, 100); | ||||||
| // λ°κ²½ 5kmλ₯Ό μκ²½λ λΈνλ‘ λ³ν (1λ β 111km, νκ΅ μλ κΈ°μ€ κ²½λ 1λ β 88km) | ||||||
| double deltaLat = 5000.0 / 111_000.0; | ||||||
| double deltaLng = 5000.0 / 88_000.0; | ||||||
| return storeRepository.findNearby( | ||||||
| latitude, longitude, | ||||||
| latitude - deltaLat, latitude + deltaLat, | ||||||
| longitude - deltaLng, longitude + deltaLng, | ||||||
| return storeRepository.findNearbyWithGist( | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. νμ¬ |
||||||
| latitude, longitude, 5000.0, | ||||||
| PageRequest.of(page, limitedSize) | ||||||
| ).stream().map(StoreListResponse::from).toList(); | ||||||
| } | ||||||
|
|
@@ -135,10 +130,11 @@ public List<StoreListResponse> getNearbyStores(double latitude, double longitude | |||||
| public List<StoreListResponse> getStoresInBounds( | ||||||
| double minLat, double maxLat, double minLng, double maxLng, | ||||||
| Double centerLat, Double centerLng, int limit) { | ||||||
| int limitedLimit = Math.min(limit, 100); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. μ λ¬λ
Suggested change
|
||||||
| double cLat = centerLat != null ? centerLat : (minLat + maxLat) / 2.0; | ||||||
| double cLng = centerLng != null ? centerLng : (minLng + maxLng) / 2.0; | ||||||
| return storeRepository | ||||||
| .findInBounds(minLat, maxLat, minLng, maxLng, cLat, cLng, PageRequest.of(0, limit)) | ||||||
| .findInBounds(minLat, maxLat, minLng, maxLng, cLat, cLng, PageRequest.of(0, limitedLimit)) | ||||||
| .stream() | ||||||
| .map(StoreListResponse::from) | ||||||
| .toList(); | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μμ²λ
sizeκ° 1 λ―Έλ§μΌ κ²½μ°,PageRequest.of()λ©μλ νΈμΆ μIllegalArgumentExceptionμ΄ λ°μν μ μμ΅λλ€. μ΅μ 1 μ΄μμ κ°μ κ°μ§λλ‘ μμ νκ² μ ννλ κ²μ΄ μ’μ΅λλ€.