Commit 1b889d4b authored by Ubbo Veentjer's avatar Ubbo Veentjer
Browse files

configurable number of max facets shown. closes #52

parent a507a0e4
Pipeline #138422 passed with stages
in 12 minutes and 18 seconds
package info.textgrid.rep.service.tgsearch; package info.textgrid.rep.service.tgsearch;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class TgrepConfigurationService { public class TgrepConfigurationService {
private static final Log log = LogFactory.getLog(TgrepConfigurationService.class);
@Value("${textgrid.host}") @Value("${textgrid.host}")
private String textgridHost; private String textgridHost;
@Value("${handle.host}") @Value("${handle.host}")
...@@ -73,13 +77,13 @@ public class TgrepConfigurationService { ...@@ -73,13 +77,13 @@ public class TgrepConfigurationService {
@PostConstruct @PostConstruct
public void postConstruct() { public void postConstruct() {
System.out.println("--------textgrid host: " + textgridHost); log.info("textgrid host: " + textgridHost);
System.out.println("--------handle host: " + handleHost); log.info("handle host: " + handleHost);
System.out.println("--------voyant host: " + toolVoyantHost); log.info("voyant host: " + toolVoyantHost);
System.out.println("--------annotate host: " + toolAnnotateHost); log.info("annotate host: " + toolAnnotateHost);
System.out.println("--------mirador host: " + toolMiradorHost); log.info("mirador host: " + toolMiradorHost);
System.out.println("--------digilib host: " + toolDigilibHost); log.info("digilib host: " + toolDigilibHost);
System.out.println("--------switchboard host: " + toolSwitchboardHost); log.info("switchboard host: " + toolSwitchboardHost);
} }
} }
...@@ -6,18 +6,27 @@ import javax.annotation.PostConstruct; ...@@ -6,18 +6,27 @@ import javax.annotation.PostConstruct;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import info.textgrid.clients.SearchClient; import info.textgrid.clients.SearchClient;
import info.textgrid.namespaces.middleware.tgsearch.FacetResponse; import info.textgrid.namespaces.middleware.tgsearch.FacetResponse;
import info.textgrid.namespaces.middleware.tgsearch.Response; import info.textgrid.namespaces.middleware.tgsearch.Response;
import info.textgrid.namespaces.middleware.tgsearch.ResultType; import info.textgrid.namespaces.middleware.tgsearch.ResultType;
@Service @Service
public class TgsearchClientService { public class TgsearchClientService {
@Value("${tgsearch.query.facetlimit}")
private int facetLimit = 10;
@Autowired
private TgrepConfigurationService tgrepConfig; private TgrepConfigurationService tgrepConfig;
private SearchClient searchClient; private SearchClient searchClient;
private static final Log log = LogFactory.getLog(TgsearchClientService.class);
private List<String> facets = Arrays.asList(new String[] { private List<String> facets = Arrays.asList(new String[] {
"edition.agent.value", "edition.agent.value",
"work.genre", "work.genre",
...@@ -25,13 +34,6 @@ public class TgsearchClientService { ...@@ -25,13 +34,6 @@ public class TgsearchClientService {
"project.value" "project.value"
}); });
private static final Log log = LogFactory.getLog(TgsearchClientService.class);
@Autowired
public TgsearchClientService(TgrepConfigurationService tgrepConfig) {
this.tgrepConfig = tgrepConfig;
}
@PostConstruct @PostConstruct
public void postConstruct() { public void postConstruct() {
this.setupClient(); this.setupClient();
...@@ -40,7 +42,7 @@ public class TgsearchClientService { ...@@ -40,7 +42,7 @@ public class TgsearchClientService {
private void setupClient() { private void setupClient() {
log.info("setting up tgsearch client for host: " + tgrepConfig.getTextgridHost()); log.info("setting up tgsearch client for host: " + tgrepConfig.getTextgridHost());
// Create Searchclient with GZIP Compression enabled // Create Searchclient with GZIP compression enabled
searchClient = new SearchClient(tgrepConfig.getTextgridHost() + "/1.0/tgsearch-public") searchClient = new SearchClient(tgrepConfig.getTextgridHost() + "/1.0/tgsearch-public")
.enableGzipCompression(); .enableGzipCompression();
...@@ -56,6 +58,7 @@ public class TgsearchClientService { ...@@ -56,6 +58,7 @@ public class TgsearchClientService {
.setStart(start) .setStart(start)
.setLimit(limit) .setLimit(limit)
.setFacetList(facets) .setFacetList(facets)
.setFacetLimit(facetLimit)
.setFilterList(filter) .setFilterList(filter)
.setSearchSandbox(sandbox) .setSearchSandbox(sandbox)
.setResolvePath(true) .setResolvePath(true)
......
...@@ -20,3 +20,5 @@ tool.switchboard.host: https://switchboard.clarin.eu/#/textgridrep ...@@ -20,3 +20,5 @@ tool.switchboard.host: https://switchboard.clarin.eu/#/textgridrep
lang.available: en, de lang.available: en, de
lang.default: en lang.default: en
tgsearch.query.facetlimit = 10000
#tgsearch.query.facetlimit = 10
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment