From 800dad47d645f64ab2bcc5a964f511fa1b08d6b4 Mon Sep 17 00:00:00 2001
From: Mirko Zizzari <mirko.zizzari@smc.it>
Date: Tue, 3 Sep 2024 17:48:07 +0200
Subject: [PATCH] issue #1077: sf

---
 .../searcher/resource/SearchResource.java     | 55 +++++++++----------
 1 file changed, 25 insertions(+), 30 deletions(-)

diff --git a/core/app/searcher/src/main/java/io/openk9/searcher/resource/SearchResource.java b/core/app/searcher/src/main/java/io/openk9/searcher/resource/SearchResource.java
index 632e8545f..944632d5a 100644
--- a/core/app/searcher/src/main/java/io/openk9/searcher/resource/SearchResource.java
+++ b/core/app/searcher/src/main/java/io/openk9/searcher/resource/SearchResource.java
@@ -89,6 +89,31 @@
 @RequestScoped
 public class SearchResource {
 
+	private static final Logger logger = Logger.getLogger(SearchResource.class);
+	private static final Object namedXContentRegistryKey = new Object();
+	private static final Pattern i18nHighlithKeyPattern = Pattern.compile(
+		"\\.i18n\\..{5,}$|\\.base$");
+	private final Map<Object, NamedXContentRegistry> namedXContentRegistryMap =
+		Collections.synchronizedMap(new IdentityHashMap<>());
+	@GrpcClient("searcher")
+	Searcher searcherClient;
+	@Inject
+	@Claim(standard = Claims.raw_token)
+	String rawToken;
+	@Inject
+	SearcherMapper searcherMapper;
+	@Inject
+	InternalSearcherMapper internalSearcherMapper;
+	@Inject
+	RestHighLevelClient restHighLevelClient;
+	@Context
+	HttpServerRequest request;
+	@Context
+	HttpHeaders
+		headers;
+	@ConfigProperty(name = "openk9.searcher.supported.headers.name", defaultValue = "OPENK9_ACL")
+	List<String> supportedHeadersName;
+
 	@POST
 	@Path("/search-query")
 	@Produces(MediaType.APPLICATION_JSON)
@@ -610,36 +635,6 @@ private Response toSearchResponse(SearchResponse searchResponse) {
 		return new Response(result, totalHits.value);
 	}
 
-	private static final Logger logger = Logger.getLogger(SearchResource.class);
-	@GrpcClient("searcher")
-	Searcher searcherClient;
-
-	@Inject
-	@Claim(standard = Claims.raw_token)
-	String rawToken;
-	@Inject
-	SearcherMapper searcherMapper;
-	@Inject
-	InternalSearcherMapper internalSearcherMapper;
-	@Inject
-	RestHighLevelClient restHighLevelClient;
-
-	@Context
-	HttpServerRequest request;
-
-	@Context
-	HttpHeaders
-	headers;
-
-	@ConfigProperty(name = "openk9.searcher.supported.headers.name", defaultValue = "OPENK9_ACL")
-	List<String> supportedHeadersName;
-
-	private final Map<Object, NamedXContentRegistry> namedXContentRegistryMap =
-		Collections.synchronizedMap(new IdentityHashMap<>());
-
-	private static final Object namedXContentRegistryKey = new Object();
-	private static final Pattern i18nHighlithKeyPattern = Pattern.compile("\\.i18n\\..{5,}$|\\.base$");
-
 	private void printShardFailures(SearchResponse searchResponse) {
 		if (searchResponse.getShardFailures() != null) {
 			for (ShardSearchFailure failure : searchResponse.getShardFailures()) {