Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
DARIAH-DE
TextGridRep Portal
Commits
1b889d4b
Commit
1b889d4b
authored
Jun 04, 2020
by
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
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/info/textgrid/rep/service/tgsearch/TgrepConfigurationService.java
View file @
1b889d4b
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
);
}
}
}
}
src/main/java/info/textgrid/rep/service/tgsearch/TgsearchClientService.java
View file @
1b889d4b
...
@@ -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
C
ompression enabled
// Create Searchclient with GZIP
c
ompression 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
)
...
...
src/main/resources/application.properties
View file @
1b889d4b
...
@@ -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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment