@@ -95,6 +95,17 @@ class StandaloneIndexing(props: SearchApiProperties, componentRegistry: Componen
9595 implicit val ec : ExecutionContextExecutorService =
9696 ExecutionContext .fromExecutorService(Executors .newFixedThreadPool(SearchType .values.size))
9797
98+ def handleOnComplete (future : Future [Try [ReindexResult ]], indexName : String ): Future [Try [ReindexResult ]] = {
99+ future.onComplete {
100+ case Success (Success (reindexResult : ReindexResult )) => logger.info(
101+ s " Completed indexing of ${reindexResult.totalIndexed} $indexName in ${reindexResult.millisUsed} ms. "
102+ )
103+ case Success (Failure (ex)) => logger.warn(ex.getMessage, ex)
104+ case Failure (ex) => logger.warn(s " Unable to create index ' $indexName': " + ex.getMessage, ex)
105+ }
106+ future
107+ }
108+
98109 def reindexWithIndexService [C <: Content ](indexService : IndexService [C ], shouldUsePublishedTax : Boolean )(
99110 implicit d : Decoder [C ]
100111 ): Future [Try [ReindexResult ]] = {
@@ -109,26 +120,34 @@ class StandaloneIndexing(props: SearchApiProperties, componentRegistry: Componen
109120 val reindexFuture = Future {
110121 indexService.indexDocuments(indexingBundle)
111122 }
112-
113- reindexFuture.onComplete {
114- case Success (Success (reindexResult : ReindexResult )) => logger.info(
115- s " Completed indexing of ${reindexResult.totalIndexed} ${indexService.searchIndex} in ${reindexResult.millisUsed} ms. "
116- )
117- case Success (Failure (ex)) => logger.warn(ex.getMessage, ex)
118- case Failure (ex) =>
119- logger.warn(s " Unable to create index ' ${indexService.searchIndex}': " + ex.getMessage, ex)
120- }
121-
122- reindexFuture
123+ handleOnComplete(reindexFuture, indexService.searchIndex)
123124 }
124125
126+ val indexingBundle = IndexingBundle (
127+ grepBundle = Some (grepBundle),
128+ taxonomyBundle = Some (taxonomyBundlePublished),
129+ myndlaBundle = Some (myndlaBundle),
130+ )
131+
125132 Await .result(
126133 Future .sequence(
127134 Seq (
128135 reindexWithIndexService(componentRegistry.learningPathIndexService, shouldUsePublishedTax = true ),
129136 reindexWithIndexService(componentRegistry.articleIndexService, shouldUsePublishedTax = true ),
130137 reindexWithIndexService(componentRegistry.draftIndexService, shouldUsePublishedTax = false ),
131138 reindexWithIndexService(componentRegistry.draftConceptIndexService, shouldUsePublishedTax = true ),
139+ handleOnComplete(
140+ Future {
141+ componentRegistry.grepIndexService.indexDocuments(None , indexingBundle.grepBundle)
142+ },
143+ " greps" ,
144+ ),
145+ handleOnComplete(
146+ Future {
147+ componentRegistry.nodeIndexService.indexDocuments(None , indexingBundle)
148+ },
149+ " nodes" ,
150+ ),
132151 )
133152 ),
134153 Duration .Inf ,
0 commit comments