Last active
December 22, 2015 19:49
-
-
Save jkyamog/6521880 to your computer and use it in GitHub Desktop.
consuming autosource findByStream and using for solr batch indexes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def batchInsert(elems: Enumerator[Iterator[T]])(implicit ctx: ExecutionContext): Future[Unit] = { | |
val indexByChunks = Iteratee.foreach[Iterator[T]] { i => | |
i.grouped(batchSize).foreach { chunk => | |
val json = Json.toJson(chunk)(Writes.seq) | |
solr.index(json) | |
} | |
} | |
elems run indexByChunks | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment