File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
importers/src/main/groovy/whelk Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,10 @@ class ImporterMain {
6666
6767 @Command (args = ' [COLLECTION] [-t NUMBEROFTHREADS]' )
6868 void reindex (String ... args ) {
69- def cli = new CliBuilder (usage : ' reindex [collection] -[ht]' )
69+ def cli = new CliBuilder (
70+ usage : ' reindex [collection] -[ht]' ,
71+ header : ' \n [collection] = auth|bib|hold|none|@type:<type>\n '
72+ )
7073 // Create the list of options.
7174 cli. with {
7275 h longOpt : ' help' , ' Show usage information'
Original file line number Diff line number Diff line change @@ -2,8 +2,10 @@ package whelk.reindexer
22
33import groovy.util.logging.Log4j2 as Log
44import whelk.Document
5+ import whelk.JsonLd
56import whelk.Whelk
67import whelk.util.BlockingThreadPool
8+ import whelk.util.Unicode
79
810@Log
911class ElasticReindexer {
@@ -73,9 +75,17 @@ class ElasticReindexer {
7375 log. info(" Collection(s) to be indexed: ${ collections} " )
7476 threadPool = BlockingThreadPool . simplePool(numberOfThreads)
7577 collections. each { collection ->
76- log. info(" Indexing collection ${ collection} " )
7778 List<Document > documents = []
78- for (document in whelk. storage. loadAll(collection)) {
79+ Iterable<Document > iterable;
80+ if (collection. startsWith(JsonLd . TYPE_KEY + " :" )) {
81+ var type = Unicode . stripPrefix(collection, JsonLd . TYPE_KEY + " :" )
82+ iterable = whelk. loadAllByType(type)
83+ log. info(" Indexing type ${ type} " )
84+ } else {
85+ iterable = whelk. storage. loadAll(collection)
86+ log. info(" Indexing collection ${ collection} " )
87+ }
88+ for (document in iterable) {
7989 if ( ! document. getDeleted() ) {
8090 documents. add(document)
8191 counter++
You can’t perform that action at this time.
0 commit comments