本文整理汇总了Golang中git-wip-us/apache/org/repos/asf/lucy-clownfish/git/runtime/go/clownfish.WRAPAny函数的典型用法代码示例。如果您正苦于以下问题:Golang WRAPAny函数的具体用法?Golang WRAPAny怎么用?Golang WRAPAny使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了WRAPAny函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: HardLink
func (f *FolderIMP) HardLink(from, to string) error {
self := (*C.lucy_Folder)(clownfish.Unwrap(f, "f"))
fromC := (*C.cfish_String)(clownfish.GoToClownfish(from, unsafe.Pointer(C.CFISH_STRING), false))
toC := (*C.cfish_String)(clownfish.GoToClownfish(to, unsafe.Pointer(C.CFISH_STRING), false))
defer C.cfish_decref(unsafe.Pointer(fromC))
defer C.cfish_decref(unsafe.Pointer(toC))
success := C.LUCY_Folder_Hard_Link(self, fromC, toC)
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,代码行数:13,代码来源:store.go
示例17: OpenDir
func (f *FolderIMP) OpenDir(path string) (retval DirHandle, err error) {
err = clownfish.TrapErr(func() {
self := (*C.lucy_Folder)(clownfish.Unwrap(f, "f"))
pathC := (*C.cfish_String)(clownfish.GoToClownfish(path, unsafe.Pointer(C.CFISH_STRING), false))
defer C.cfish_decref(unsafe.Pointer(pathC))
retvalC := C.LUCY_Folder_Open_Dir(self, pathC)
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,代码行数:14,代码来源:store.go
示例18: OpenRAMFileHandle
func OpenRAMFileHandle(path string, flags uint32, ramFile RAMFile) (fh RAMFileHandle, err error) {
err = clownfish.TrapErr(func() {
pathC := (*C.cfish_String)(clownfish.GoToClownfish(path, unsafe.Pointer(C.CFISH_STRING), false))
ramFileC := (*C.lucy_RAMFile)(clownfish.GoToClownfish(ramFile, unsafe.Pointer(C.LUCY_RAMFILE), true))
defer C.cfish_decref(unsafe.Pointer(pathC))
cfObj := C.lucy_RAMFH_open(pathC, C.uint32_t(flags), ramFileC)
if cfObj == nil {
cfErr := C.cfish_Err_get_error()
panic(clownfish.WRAPAny(unsafe.Pointer(C.cfish_incref(unsafe.Pointer(cfErr)))).(error))
}
fh = WRAPRAMFileHandle(unsafe.Pointer(cfObj))
})
return fh, err
}
开发者ID:rlugojr,项目名称:lucy,代码行数:14,代码来源:store.go
示例19: LocalOpenFileHandle
func (f *FolderIMP) LocalOpenFileHandle(name string, flags uint32) (retval FileHandle, err error) {
err = clownfish.TrapErr(func() {
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))
retvalC := C.LUCY_Folder_Local_Open_FileHandle(self, nameC, C.uint32_t(flags))
if retvalC == nil {
cfErr := C.cfish_Err_get_error()
panic(clownfish.WRAPAny(unsafe.Pointer(C.cfish_incref(unsafe.Pointer(cfErr)))).(error))
}
retval = WRAPFileHandle(unsafe.Pointer(retvalC))
})
return retval, err
}
开发者ID:rlugojr,项目名称:lucy,代码行数:14,代码来源:store.go
示例20: MakeMatcher
func (c *CompilerIMP) MakeMatcher(reader SegReader, needScore bool) (retval Matcher, err error) {
err = clownfish.TrapErr(func() {
self := (*C.lucy_Compiler)(clownfish.Unwrap(c, "c"))
readerCF := (*C.lucy_SegReader)(clownfish.Unwrap(reader, "reader"))
retvalCF := C.LUCY_Compiler_Make_Matcher(self, readerCF, C.bool(needScore))
if retvalCF != nil {
retval = clownfish.WRAPAny(unsafe.Pointer(retvalCF)).(Matcher)
}
})
if err != nil || retval == nil {
return nil, err
}
return retval, err
}
开发者ID:rlugojr,项目名称:lucy,代码行数:14,代码来源:search.go
注:本文中的git-wip-us/apache/org/repos/asf/lucy-clownfish/git/runtime/go/clownfish.WRAPAny函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论