github.com/balzaczyy/golucene@v0.0.0-20151210033525-d0be9ee89713/core/index/invertedDocEndConsumerPerField.go (about) 1 package index 2 3 // import ( 4 // "github.com/balzaczyy/golucene/core/index/model" 5 // ) 6 7 // index/InvertedDocEndConsumerPerField.java 8 9 // type InvertedDocEndConsumerPerField interface { 10 // finish() error 11 // abort() 12 // } 13 14 // index/NormsConsumerPerField.java 15 16 // type NormsConsumerPerField struct { 17 // fieldInfo *model.FieldInfo 18 // docState *docState 19 // similarity Similarity 20 // fieldState *FieldInvertState 21 // consumer *NumericDocValuesWriter 22 // } 23 24 // func newNormsConsumerPerField(docInverterPerField *DocInverterPerField, 25 // fieldInfo *model.FieldInfo, parent *NormsConsumer) *NormsConsumerPerField { 26 // return &NormsConsumerPerField{ 27 // fieldInfo: fieldInfo, 28 // docState: docInverterPerField.docState, 29 // fieldState: docInverterPerField.fieldState, 30 // similarity: docInverterPerField.docState.similarity, 31 // } 32 // } 33 34 // func (nc *NormsConsumerPerField) finish() error { 35 // if nc.fieldInfo.IsIndexed() && !nc.fieldInfo.OmitsNorms() { 36 // if nc.consumer == nil { 37 // nc.fieldInfo.SetNormValueType(model.DOC_VALUES_TYPE_NUMERIC) 38 // nc.consumer = newNumericDocValuesWriter(nc.fieldInfo, nc.docState.docWriter._bytesUsed, false) 39 // } 40 // nc.consumer.addValue(nc.docState.docID, nc.similarity.ComputeNorm(nc.fieldState)) 41 // } 42 // return nil 43 // } 44 45 // func (nc *NormsConsumerPerField) flush(state *model.SegmentWriteState, 46 // normsWriter DocValuesConsumer) error { 47 48 // docCount := state.SegmentInfo.DocCount() 49 // if nc.consumer == nil { 50 // return nil // nil type - not omitted but not written - 51 // // meaning the only docs that had 52 // // norms hit erros (but indexed=true is set...) 53 // } 54 // nc.consumer.finish(docCount) 55 // return nc.consumer.flush(state, normsWriter) 56 // } 57 58 // func (nc *NormsConsumerPerField) isEmpty() bool { 59 // return nc.consumer == nil 60 // } 61 62 // func (nc *NormsConsumerPerField) abort() {}