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;
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.stereotype.Service;
@Service
public class TgrepConfigurationService {
private static final Log log = LogFactory.getLog(TgrepConfigurationService.class);
@Value("${textgrid.host}")
private String textgridHost;
@Value("${handle.host}")
......@@ -73,13 +77,13 @@ public class TgrepConfigurationService {
@PostConstruct
public void postConstruct() {
System.out.println("--------textgrid host: " + textgridHost);
System.out.println("--------handle host: " + handleHost);
System.out.println("--------voyant host: " + toolVoyantHost);
System.out.println("--------annotate host: " + toolAnnotateHost);
System.out.println("--------mirador host: " + toolMiradorHost);
System.out.println("--------digilib host: " + toolDigilibHost);
System.out.println("--------switchboard host: " + toolSwitchboardHost);
log.info("textgrid host: " + textgridHost);
log.info("handle host: " + handleHost);
log.info("voyant host: " + toolVoyantHost);
log.info("annotate host: " + toolAnnotateHost);
log.info("mirador host: " + toolMiradorHost);
log.info("digilib host: " + toolDigilibHost);
log.info("switchboard host: " + toolSwitchboardHost);
}
}
......@@ -6,18 +6,27 @@ import javax.annotation.PostConstruct;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import info.textgrid.clients.SearchClient;
import info.textgrid.namespaces.middleware.tgsearch.FacetResponse;
import info.textgrid.namespaces.middleware.tgsearch.Response;
import info.textgrid.namespaces.middleware.tgsearch.ResultType;
@Service
public class TgsearchClientService {
@Value("${tgsearch.query.facetlimit}")
private int facetLimit = 10;
@Autowired
private TgrepConfigurationService tgrepConfig;
private SearchClient searchClient;
private static final Log log = LogFactory.getLog(TgsearchClientService.class);
private List<String> facets = Arrays.asList(new String[] {
"edition.agent.value",
"work.genre",
......@@ -25,13 +34,6 @@ public class TgsearchClientService {
"project.value"
});
private static final Log log = LogFactory.getLog(TgsearchClientService.class);
@Autowired
public TgsearchClientService(TgrepConfigurationService tgrepConfig) {
this.tgrepConfig = tgrepConfig;
}
@PostConstruct
public void postConstruct() {
this.setupClient();
......@@ -40,7 +42,7 @@ public class TgsearchClientService {
private void setupClient() {
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")
.enableGzipCompression();
......@@ -56,6 +58,7 @@ public class TgsearchClientService {
.setStart(start)
.setLimit(limit)
.setFacetList(facets)
.setFacetLimit(facetLimit)
.setFilterList(filter)
.setSearchSandbox(sandbox)
.setResolvePath(true)
......
......@@ -20,3 +20,5 @@ tool.switchboard.host: https://switchboard.clarin.eu/#/textgridrep
lang.available: en, de
lang.default: en
tgsearch.query.facetlimit = 10000
#tgsearch.query.facetlimit = 10
\ No newline at end of file
Markdown is supported
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