當前位置: 首頁>>代碼示例>>Golang>>正文


Golang IndexOutput.WriteVInt方法代碼示例

本文整理匯總了Golang中github.com/balzaczyy/golucene/core/store.IndexOutput.WriteVInt方法的典型用法代碼示例。如果您正苦於以下問題:Golang IndexOutput.WriteVInt方法的具體用法?Golang IndexOutput.WriteVInt怎麽用?Golang IndexOutput.WriteVInt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/balzaczyy/golucene/core/store.IndexOutput的用法示例。


在下文中一共展示了IndexOutput.WriteVInt方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: writeClearedDgaps

/* Write as a d-gaps list */
func (bv *BitVector) writeClearedDgaps(output store.IndexOutput) error {
	err := store.Stream(output).
		WriteInt(-1). // mark using d-gaps
		WriteInt(int32(bv.size)).
		WriteInt(int32(bv.Count())).
		Close()
	if err != nil {
		return err
	}
	last, numCleared := 0, bv.size-bv.Count()
	for i, v := range bv.bits {
		if v == byte(0xff) {
			continue
		}
		err = output.WriteVInt(int32(i - last))
		if err == nil {
			err = output.WriteByte(v)
		}
		if err != nil {
			return err
		}
		last = i
		numCleared -= (8 - util.BitCount(v))
		assert(numCleared >= 0 ||
			i == len(bv.bits)-1 && numCleared == -(8-(bv.size&7)))
		if numCleared <= 0 {
			break
		}
	}
	return nil
}
開發者ID:kiskovacs,項目名稱:golucene,代碼行數:32,代碼來源:bitVector.go

示例2: Init

func (w *Lucene41PostingsWriter) Init(termsOut store.IndexOutput) error {
	err := codec.WriteHeader(termsOut, LUCENE41_TERMS_CODEC, LUCENE41_VERSION_CURRENT)
	if err == nil {
		err = termsOut.WriteVInt(LUCENE41_BLOCK_SIZE)
	}
	return err
}
開發者ID:kiskovacs,項目名稱:golucene,代碼行數:7,代碼來源:postingsWriter.go

示例3: NewStoredFieldsIndexWriter

func NewStoredFieldsIndexWriter(indexOutput store.IndexOutput) (*StoredFieldsIndexWriter, error) {
	err := indexOutput.WriteVInt(packed.VERSION_CURRENT)
	if err != nil {
		return nil, err
	}
	return &StoredFieldsIndexWriter{
		fieldsIndexOut:     indexOutput,
		blockChunks:        0,
		blockDocs:          0,
		firstStartPointer:  -1,
		totalDocs:          0,
		docBaseDeltas:      make([]int, BLOCK_SIZE),
		startPointerDeltas: make([]int64, BLOCK_SIZE),
	}, nil
}
開發者ID:voidException,項目名稱:golucene,代碼行數:15,代碼來源:storedFieldsIndexWriter.go

示例4: writeBytesRef

func writeBytesRef(out store.IndexOutput, bytes []byte) (err error) {
	if err = out.WriteVInt(int32(len(bytes))); err == nil {
		err = out.WriteBytes(bytes)
	}
	return
}
開發者ID:kiskovacs,項目名稱:golucene,代碼行數:6,代碼來源:termsWriter.go

示例5: WriteSkipData

func (w *SkipWriter) WriteSkipData(level int, skipBuffer store.IndexOutput) error {
	delta := w.curDoc - w.lastSkipDoc[level]
	var err error
	if err = skipBuffer.WriteVInt(int32(delta)); err != nil {
		return err
	}
	w.lastSkipDoc[level] = w.curDoc

	if err = skipBuffer.WriteVInt(int32(w.curDocPointer - w.lastSkipDocPointer[level])); err != nil {
		return err
	}
	w.lastSkipDocPointer[level] = w.curDocPointer

	if w.fieldHasPositions {
		if err = skipBuffer.WriteVInt(int32(w.curPosPointer - w.lastSkipPosPointer[level])); err != nil {
			return err
		}
		w.lastSkipPosPointer[level] = w.curPosPointer
		if err = skipBuffer.WriteVInt(int32(w.curPosBufferUpto)); err != nil {
			return err
		}

		if w.fieldHasPayloads {
			if err = skipBuffer.WriteVInt(int32(w.curPayloadByteUpto)); err != nil {
				return err
			}
		}

		if w.fieldHasOffsets || w.fieldHasPayloads {
			if err = skipBuffer.WriteVInt(int32(w.curPayPointer - w.lastSkipPayPointer[level])); err != nil {
				return err
			}
			w.lastSkipPayPointer[level] = w.curPayPointer
		}
	}
	return nil
}
開發者ID:kiskovacs,項目名稱:golucene,代碼行數:37,代碼來源:skipWriter.go

示例6:

		return
	}

	var success = false
	defer func() {
		if success {
			err = output.Close()
		} else {
			util.CloseWhileSuppressingError(output)
		}
	}()

	if err = codec.WriteHeader(output, FI_CODEC_NAME, FI_FORMAT_CURRENT); err != nil {
		return
	}
	if err = output.WriteVInt(int32(infos.Size())); err != nil {
		return
	}
	for _, fi := range infos.Values {
		indexOptions := fi.IndexOptions()
		bits := byte(0)
		if fi.HasVectors() {
			bits |= FI_STORE_TERMVECTOR
		}
		if fi.OmitsNorms() {
			bits |= FI_OMIT_NORMS
		}
		if fi.HasPayloads() {
			bits |= FI_STORE_PAYLOADS
		}
		if fi.IsIndexed() {
開發者ID:kiskovacs,項目名稱:golucene,代碼行數:31,代碼來源:fieldInfos.go


注:本文中的github.com/balzaczyy/golucene/core/store.IndexOutput.WriteVInt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。