How to speed up indexing #1834
-
Hello, I am exploring bleve to handle search for https://gitlab.com/kskarthik/go-ifsc & i am having a couple of questions
for i := range csvSlice[1:] {
index.Index(csvSlice[i][1], csvSlice[i])
}
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
bleve supports indexing batch wise (which is less expensive at the end of the day when compared with directly indexing docs separately). what can be done is create a batch using:
and then put the docs inside the batch using and periodically (every 1000 docs for eg) index this batch using
also, the batch variable itself can be reused for indexing the next batch of docs by reseting the batch using Iterating the map itself can be done using the range functionality ( |
Beta Was this translation helpful? Give feedback.
bleve supports indexing batch wise (which is less expensive at the end of the day when compared with directly indexing docs separately). what can be done is create a batch using:
batch := index.NewBatch()
and then put the docs inside the batch using
err := batch.Index(docID, doc)
and periodically (every 1000 docs for eg) index this batch using
err := index.Batch(batch)
also, the batch variable itself can be reused for indexing the next batch of docs by reseting the batch using
batch.Reset()
before the next operation.Iterating the map itself can be done using the range functionality (
for k, v := range map { ... }
). The Fields map I believe is keyed by the field name and the value is conte…