Skip to content

Commit

Permalink
Merge branch 'main' into refactor/#90
Browse files Browse the repository at this point in the history
  • Loading branch information
sycuuui committed Aug 28, 2024
2 parents 54c4cdf + 9b1de23 commit 6662778
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public ApiResponse<?> updatePlaceMyReview(
}
@GetMapping("/search")
public ApiResponse<SearchPlaceRes> searchPlaceList(
@RequestParam @NotNull String category,
@RequestParam(required = false) String category,
@RequestParam(required = false) String query,
@RequestParam(required = false) List<Long> disabilityType,
@RequestParam(required = false) List<Long> detailFilter,
Expand All @@ -113,7 +113,7 @@ public ApiResponse<SearchPlaceRes> searchPlaceList(

@GetMapping("/search/map")
public ApiResponse<List<PlaceRes>> searchPlaceList(
@RequestParam @NotNull String category,
@RequestParam(required = false) String category,
@RequestParam @NotNull Double minX,
@RequestParam @NotNull Double maxX,
@RequestParam @NotNull Double minY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ public List<Place> searchMap(String category,List<Long> disabilityType, List<Lon
}

private BooleanExpression categoryEq(String category) {
if(category == null || category.isEmpty())
return null;

List<String> categoryList = new ArrayList<>(Arrays.asList("A01", "A02", "A03", "A04", "B01", "C01"));

if(category.equals("ROOM"))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package Journey.Together.global.config;

import org.apache.http.client.CredentialsProvider;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.client.RestClientBuilder;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;

public class ElasticsearchClient {

public static RestHighLevelClient createClient() {
// Elasticsearch 클러스터 호스트와 포트 설정
HttpHost host = new HttpHost("localhost", 9200, "http");

// 인증 정보를 설정
CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("username", "password"));

// RestClientBuilder 생성
RestClientBuilder builder = RestClient.builder(host)
.setHttpClientConfigCallback(httpClientBuilder -> {
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
});

// RestHighLevelClient 생성
return new RestHighLevelClient(builder);
}
}

0 comments on commit 6662778

Please sign in to comment.