本文整理汇总了Golang中github.com/balzaczyy/golucene/core/store.Directory.Close方法的典型用法代码示例。如果您正苦于以下问题:Golang Directory.Close方法的具体用法?Golang Directory.Close怎么用?Golang Directory.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/balzaczyy/golucene/core/store.Directory
的用法示例。
在下文中一共展示了Directory.Close方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ReadFieldInfos
/* Reads the most recent FieldInfos of the given segment info. */
func ReadFieldInfos(info *SegmentCommitInfo) (fis FieldInfos, err error) {
var dir store.Directory
var closeDir bool
if info.FieldInfosGen() == -1 && info.Info.IsCompoundFile() {
// no fieldInfos gen and segment uses a compound file
if dir, err = store.NewCompoundFileDirectory(info.Info.Dir,
util.SegmentFileName(info.Info.Name, "", store.COMPOUND_FILE_EXTENSION),
store.IO_CONTEXT_READONCE, false); err != nil {
return
}
closeDir = true
} else {
// gen'd FIS are read outside CFS, or the segment doesn't use a compound file
dir = info.Info.Dir
closeDir = false
}
defer func() {
if closeDir {
err = mergeError(err, dir.Close())
}
}()
var segmentSuffix string
if n := info.FieldInfosGen(); n != -1 {
segmentSuffix = strconv.FormatInt(n, 36)
}
codec := info.Info.Codec().(Codec)
fisFormat := codec.FieldInfosFormat()
return fisFormat.FieldInfosReader()(dir, info.Info.Name, segmentSuffix, store.IO_CONTEXT_READONCE)
}