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


Golang IndexOutput.WriteByte方法代碼示例

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


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

		}
		if fi.IsIndexed() {
			bits |= FI_IS_INDEXED
			assert(indexOptions >= INDEX_OPT_DOCS_AND_FREQS_AND_POSITIONS || !fi.HasPayloads())
			switch indexOptions {
			case INDEX_OPT_DOCS_ONLY:
				bits |= FI_OMIT_TERM_FREQ_AND_POSITIONS
			case INDEX_OPT_DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS:
				bits |= FI_STORE_OFFSETS_IN_POSTINGS
			case INDEX_OPT_DOCS_AND_FREQS:
				bits |= FI_OMIT_POSITIONS
			}
		}
		if err = output.WriteString(fi.Name); err == nil {
			if err = output.WriteVInt(fi.Number); err == nil {
				err = output.WriteByte(bits)
			}
		}
		if err != nil {
			return
		}

		// pack the DV types in one byte
		dv := byte(fi.DocValuesType())
		nrm := byte(fi.NormType())
		assert((dv&(^byte(0xF))) == 0 && (nrm&(^byte(0x0F))) == 0)
		val := (0xff & ((nrm << 4) | dv))
		if err = output.WriteByte(val); err == nil {
			if err = output.WriteLong(fi.DocValuesGen()); err == nil {
				err = output.WriteStringStringMap(fi.Attributes())
			}
開發者ID:kiskovacs,項目名稱:golucene,代碼行數:31,代碼來源:fieldInfos.go


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