예제 #1
0
파일: compound.go 프로젝트: vasth/golucene
func (d *CompoundFileDirectory) FileExists(name string) bool {
	d.ensureOpen()
	// if d.writer != nil {
	// 	return d.writer.FileExists(name)
	// }
	_, ok := d.entries[util.StripSegmentName(name)]
	return ok
}
예제 #2
0
파일: compound.go 프로젝트: vasth/golucene
func (d *CompoundFileDirectory) OpenInput(name string, context IOContext) (in IndexInput, err error) {
	d.ensureOpen()
	// assert !d.openForWrite
	id := util.StripSegmentName(name)
	if entry, ok := d.entries[id]; ok {
		is := d.handle.openSlice(name, entry.offset, entry.length)
		return is, nil
	}
	keys := make([]string, 0)
	for k := range d.entries {
		keys = append(keys, k)
	}
	panic(fmt.Sprintf("No sub-file with id %v found (fileName=%v files: %v)", id, name, keys))
}