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


Golang clownfish.WRAPAny函數代碼示例

本文整理匯總了Golang中git-wip-us/apache/org/repos/asf/lucy-clownfish/git/runtime/go/clownfish.WRAPAny函數的典型用法代碼示例。如果您正苦於以下問題:Golang WRAPAny函數的具體用法?Golang WRAPAny怎麽用?Golang WRAPAny使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: Next

func (h *HitsIMP) Next(hit interface{}) bool {
	self := (*C.lucy_Hits)(clownfish.Unwrap(h, "h"))
	ivars := C.lucy_Hits_IVARS(self)
	matchDoc := (*C.lucy_MatchDoc)(unsafe.Pointer(
		C.CFISH_Vec_Fetch(ivars.match_docs, C.size_t(ivars.offset))))
	ivars.offset += 1

	if matchDoc == nil {
		// Bail if there aren't any more *captured* hits.  (There may be
		// more total hits.)
		return false
	} else {
		// Lazily fetch HitDoc, set score.
		searcher := clownfish.WRAPAny(unsafe.Pointer(C.cfish_incref(
			unsafe.Pointer(ivars.searcher)))).(Searcher)
		docID := int32(C.LUCY_MatchDoc_Get_Doc_ID(matchDoc))
		err := searcher.ReadDoc(docID, hit)
		if err != nil {
			h.err = err
			return false
		}
		if ss, ok := hit.(setScorer); ok {
			ss.SetScore(float32(C.LUCY_MatchDoc_Get_Score(matchDoc)))
		}
		return true
	}
}
開發者ID:rlugojr,項目名稱:lucy,代碼行數:27,代碼來源:search.go

示例2: Obtain

func (lock *LockIMP) Obtain() error {
	self := (*C.lucy_Lock)(clownfish.Unwrap(lock, "lock"))
	success := C.LUCY_Lock_Obtain(self)
	if !success {
		cfErr := C.cfish_Err_get_error()
		return clownfish.WRAPAny(unsafe.Pointer(C.cfish_incref(unsafe.Pointer(cfErr)))).(error)
	}
	return nil
}
開發者ID:rlugojr,項目名稱:lucy,代碼行數:9,代碼來源:store.go

示例3: doNewQueryParser

func doNewQueryParser(schema Schema, defaultBoolop string, fields []string) QueryParser {
	schemaCF := (*C.lucy_Schema)(clownfish.Unwrap(schema, "schema"))
	defaultBoolopCF := (*C.cfish_String)(clownfish.GoToClownfish(defaultBoolop, unsafe.Pointer(C.CFISH_STRING), true))
	defer C.cfish_decref(unsafe.Pointer(defaultBoolopCF))
	fieldsCF := stringSliceToVec(fields)
	defer C.cfish_decref(unsafe.Pointer(fieldsCF))
	retvalCF := C.lucy_QParser_new(schemaCF, nil, defaultBoolopCF, fieldsCF)
	return clownfish.WRAPAny(unsafe.Pointer(retvalCF)).(QueryParser)
}
開發者ID:rlugojr,項目名稱:lucy,代碼行數:9,代碼來源:search.go

示例4: ReleaseWindow

func (fh *FileHandleIMP) ReleaseWindow(window FileWindow) error {
	self := (*C.lucy_FileHandle)(clownfish.Unwrap(fh, "fh"))
	windowC := (*C.lucy_FileWindow)(clownfish.Unwrap(window, "window"))
	success := C.LUCY_FH_Release_Window(self, windowC)
	if !success {
		cfErr := C.cfish_Err_get_error()
		return clownfish.WRAPAny(unsafe.Pointer(C.cfish_incref(unsafe.Pointer(cfErr)))).(error)
	}
	return nil
}
開發者ID:rlugojr,項目名稱:lucy,代碼行數:10,代碼來源:store.go

示例5: Window

func (fh *FileHandleIMP) Window(window FileWindow, offset, length int64) error {
	self := (*C.lucy_FileHandle)(clownfish.Unwrap(fh, "fh"))
	windowC := (*C.lucy_FileWindow)(clownfish.Unwrap(window, "window"))
	success := C.LUCY_FH_Window(self, windowC, C.int64_t(offset), C.int64_t(length))
	if !success {
		cfErr := C.cfish_Err_get_error()
		return clownfish.WRAPAny(unsafe.Pointer(C.cfish_incref(unsafe.Pointer(cfErr)))).(error)
	}
	return nil
}
開發者ID:rlugojr,項目名稱:lucy,代碼行數:10,代碼來源:store.go

示例6: Obtain

func (r *IndexReaderIMP) Obtain(api string) (retval DataReader, err error) {
	err = clownfish.TrapErr(func() {
		self := (*C.lucy_IndexReader)(clownfish.Unwrap(r, "r"))
		apiC := (*C.cfish_String)(clownfish.GoToClownfish(api, unsafe.Pointer(C.CFISH_STRING), false))
		defer C.cfish_decref(unsafe.Pointer(apiC))
		retvalCF := C.LUCY_IxReader_Obtain(self, apiC)
		retval = clownfish.WRAPAny(unsafe.Pointer(C.cfish_incref(unsafe.Pointer(retvalCF)))).(DataReader)
	})
	return retval, err
}
開發者ID:rlugojr,項目名稱:lucy,代碼行數:10,代碼來源:index.go

示例7: GetAnalyzers

func (p *PolyAnalyzerIMP) GetAnalyzers() []Analyzer {
	self := (*C.lucy_PolyAnalyzer)(clownfish.Unwrap(p, "p"))
	retvalCF := C.LUCY_PolyAnalyzer_Get_Analyzers(self)
	size := C.CFISH_Vec_Get_Size(retvalCF)
	retval := make([]Analyzer, int(size))
	for i := 0; i < int(size); i++ {
		child := unsafe.Pointer(C.CFISH_Vec_Fetch(retvalCF, C.size_t(i)))
		retval[i] = clownfish.WRAPAny(unsafe.Pointer(C.cfish_incref(child))).(Analyzer)
	}
	return retval
}
開發者ID:rlugojr,項目名稱:lucy,代碼行數:11,代碼來源:analysis.go

示例8: segDeletions

func (d *DeletionsWriterIMP) segDeletions(segReader SegReader) (retval Matcher, err error) {
	err = clownfish.TrapErr(func() {
		self := (*C.lucy_DeletionsWriter)(clownfish.Unwrap(d, "d"))
		segReaderCF := (*C.lucy_SegReader)(clownfish.Unwrap(segReader, "segReader"))
		retvalCF := C.LUCY_DelWriter_Seg_Deletions(self, segReaderCF)
		if retvalCF != nil {
			retval = clownfish.WRAPAny(unsafe.Pointer(retvalCF)).(Matcher)
		}
	})
	return retval, err
}
開發者ID:rlugojr,項目名稱:lucy,代碼行數:11,代碼來源:index.go

示例9: OpenIndexReader

func OpenIndexReader(index interface{}, snapshot Snapshot, manager IndexManager) (retval IndexReader, err error) {
	err = clownfish.TrapErr(func() {
		indexC := (*C.cfish_Obj)(clownfish.GoToClownfish(index, unsafe.Pointer(C.CFISH_OBJ), false))
		defer C.cfish_decref(unsafe.Pointer(indexC))
		snapshotC := (*C.lucy_Snapshot)(clownfish.UnwrapNullable(snapshot))
		managerC := (*C.lucy_IndexManager)(clownfish.UnwrapNullable(manager))
		cfObj := C.lucy_IxReader_open(indexC, snapshotC, managerC)
		retval = clownfish.WRAPAny(unsafe.Pointer(cfObj)).(IndexReader)
	})
	return retval, err
}
開發者ID:rlugojr,項目名稱:lucy,代碼行數:11,代碼來源:index.go

示例10: LocalMkDir

func (f *FolderIMP) LocalMkDir(name string) error {
	self := (*C.lucy_Folder)(clownfish.Unwrap(f, "f"))
	nameC := (*C.cfish_String)(clownfish.GoToClownfish(name, unsafe.Pointer(C.CFISH_STRING), false))
	defer C.cfish_decref(unsafe.Pointer(nameC))
	success := C.LUCY_Folder_Local_MkDir(self, nameC)
	if !success {
		cfErr := C.cfish_Err_get_error()
		return clownfish.WRAPAny(unsafe.Pointer(C.cfish_incref(unsafe.Pointer(cfErr)))).(error)
	}
	return nil
}
開發者ID:rlugojr,項目名稱:lucy,代碼行數:11,代碼來源:store.go

示例11: LocalOpenDir

func (f *FolderIMP) LocalOpenDir() (retval DirHandle, err error) {
	err = clownfish.TrapErr(func() {
		self := (*C.lucy_Folder)(clownfish.Unwrap(f, "f"))
		retvalC := C.LUCY_Folder_Local_Open_Dir(self)
		if retvalC == nil {
			cfErr := C.cfish_Err_get_error()
			panic(clownfish.WRAPAny(unsafe.Pointer(C.cfish_incref(unsafe.Pointer(cfErr)))).(error))
		}
		retval = WRAPDirHandle(unsafe.Pointer(retvalC))
	})
	return retval, err
}
開發者ID:rlugojr,項目名稱:lucy,代碼行數:12,代碼來源:store.go

示例12: MakeCompiler

func (q *QueryIMP) MakeCompiler(searcher Searcher, boost float32,
	subordinate bool) (retval Compiler, err error) {
	err = clownfish.TrapErr(func() {
		self := (*C.lucy_Query)(clownfish.Unwrap(q, "q"))
		searcherCF := (*C.lucy_Searcher)(clownfish.Unwrap(searcher, "searcher"))
		retvalCF := C.LUCY_Query_Make_Compiler(self, searcherCF, C.float(boost), C.bool(subordinate))
		if retvalCF != nil {
			retval = clownfish.WRAPAny(unsafe.Pointer(retvalCF)).(Compiler)
		}
	})
	return retval, err
}
開發者ID:rlugojr,項目名稱:lucy,代碼行數:12,代碼來源:search.go

示例13: OpenCompoundFileReader

func OpenCompoundFileReader(folder Folder) (reader CompoundFileReader, err error) {
	err = clownfish.TrapErr(func() {
		folderC := (*C.lucy_Folder)(clownfish.Unwrap(folder, "Folder"))
		cfObj := C.lucy_CFReader_open(folderC)
		if cfObj == nil {
			cfErr := C.cfish_Err_get_error()
			panic(clownfish.WRAPAny(unsafe.Pointer(C.cfish_incref(unsafe.Pointer(cfErr)))).(error))
		}
		reader = WRAPCompoundFileReader(unsafe.Pointer(cfObj))
	})
	return reader, err
}
開發者ID:rlugojr,項目名稱:lucy,代碼行數:12,代碼來源:store.go

示例14: OpenOutStream

func OpenOutStream(file interface{}) (out OutStream, err error) {
	err = clownfish.TrapErr(func() {
		fileC := (*C.cfish_Obj)(clownfish.GoToClownfish(file, unsafe.Pointer(C.CFISH_OBJ), false))
		defer C.cfish_decref(unsafe.Pointer(fileC))
		cfObj := C.lucy_OutStream_open(fileC)
		if cfObj == nil {
			cfErr := C.cfish_Err_get_error()
			panic(clownfish.WRAPAny(unsafe.Pointer(C.cfish_incref(unsafe.Pointer(cfErr)))).(error))
		}
		out = WRAPOutStream(unsafe.Pointer(cfObj))
	})
	return out, err
}
開發者ID:rlugojr,項目名稱:lucy,代碼行數:13,代碼來源:store.go

示例15: OpenFSDirHandle

func OpenFSDirHandle(path string) (dh FSDirHandle, err error) {
	err = clownfish.TrapErr(func() {
		pathC := (*C.cfish_String)(clownfish.GoToClownfish(path, unsafe.Pointer(C.CFISH_STRING), false))
		defer C.cfish_decref(unsafe.Pointer(pathC))
		cfObj := C.lucy_FSDH_open(pathC)
		if cfObj == nil {
			cfErr := C.cfish_Err_get_error()
			panic(clownfish.WRAPAny(unsafe.Pointer(C.cfish_incref(unsafe.Pointer(cfErr)))).(error))
		}
		dh = WRAPFSDirHandle(unsafe.Pointer(cfObj))
	})
	return dh, err
}
開發者ID:rlugojr,項目名稱:lucy,代碼行數:13,代碼來源:store.go


注:本文中的git-wip-us/apache/org/repos/asf/lucy-clownfish/git/runtime/go/clownfish.WRAPAny函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。