本文整理汇总了Golang中git-wip-us/apache/org/repos/asf/lucy-clownfish/git/runtime/go/clownfish.GoToClownfish函数的典型用法代码示例。如果您正苦于以下问题:Golang GoToClownfish函数的具体用法?Golang GoToClownfish怎么用?Golang GoToClownfish使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GoToClownfish函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: DeleteByTerm
func (d *DeletionsWriterIMP) DeleteByTerm(field string, term interface{}) error {
return clownfish.TrapErr(func() {
self := (*C.lucy_DeletionsWriter)(clownfish.Unwrap(d, "d"))
fieldCF := (*C.cfish_String)(clownfish.GoToClownfish(field, unsafe.Pointer(C.CFISH_STRING), false))
defer C.cfish_decref(unsafe.Pointer(fieldCF))
termCF := (*C.cfish_Obj)(clownfish.GoToClownfish(term, unsafe.Pointer(C.CFISH_OBJ), false))
defer C.cfish_decref(unsafe.Pointer(termCF))
C.LUCY_DelWriter_Delete_By_Term(self, fieldCF, termCF)
})
}
开发者ID:rlugojr,项目名称:lucy,代码行数:10,代码来源:index.go
示例2: OpenSimple
func OpenSimple(index interface{}, language string) (s Simple, err error) {
indexC := (*C.cfish_Obj)(clownfish.GoToClownfish(index, unsafe.Pointer(C.CFISH_OBJ), false))
defer C.cfish_decref(unsafe.Pointer(indexC))
languageC := (*C.cfish_String)(clownfish.GoToClownfish(language, unsafe.Pointer(C.CFISH_STRING), false))
defer C.cfish_decref(unsafe.Pointer(languageC))
err = clownfish.TrapErr(func() {
cfObj := C.lucy_Simple_new(indexC, languageC)
s = WRAPSimple(unsafe.Pointer(cfObj))
})
return s, err
}
开发者ID:rectang,项目名称:lucy,代码行数:11,代码来源:simple.go
示例3: DocFreq
func (lr *LexiconReaderIMP) DocFreq(field string, term interface{}) (retval uint32, err error) {
err = clownfish.TrapErr(func() {
self := (*C.lucy_LexiconReader)(clownfish.Unwrap(lr, "lr"))
fieldC := (*C.cfish_String)(clownfish.GoToClownfish(field, unsafe.Pointer(C.CFISH_STRING), false))
defer C.cfish_decref(unsafe.Pointer(fieldC))
termC := (*C.cfish_Obj)(clownfish.GoToClownfish(term, unsafe.Pointer(C.CFISH_OBJ), true))
defer C.cfish_decref(unsafe.Pointer(termC))
retval = uint32(C.LUCY_LexReader_Doc_Freq(self, fieldC, termC))
})
return retval, err
}
开发者ID:rlugojr,项目名称:lucy,代码行数:11,代码来源:index.go
示例4: 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
示例5: NewTermVector
func NewTermVector(field, text string, positions, startOffsets, endOffsets []int32) TermVector {
fieldC := (*C.cfish_String)(clownfish.GoToClownfish(field, unsafe.Pointer(C.CFISH_STRING), false))
textC := (*C.cfish_String)(clownfish.GoToClownfish(text, unsafe.Pointer(C.CFISH_STRING), false))
defer C.cfish_decref(unsafe.Pointer(fieldC))
defer C.cfish_decref(unsafe.Pointer(textC))
posits := NewI32Array(positions)
starts := NewI32Array(startOffsets)
ends := NewI32Array(endOffsets)
positsC := (*C.lucy_I32Array)(clownfish.Unwrap(posits, "posits"))
startsC := (*C.lucy_I32Array)(clownfish.Unwrap(starts, "starts"))
endsC := (*C.lucy_I32Array)(clownfish.Unwrap(ends, "ends"))
retvalC := C.lucy_TV_new(fieldC, textC, positsC, startsC, endsC)
return WRAPTermVector(unsafe.Pointer(retvalC))
}
开发者ID:rlugojr,项目名称:lucy,代码行数:14,代码来源:index.go
示例6: 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
示例7: fetchTermInfo
func (lr *LexiconReaderIMP) fetchTermInfo(field string, term interface{}) (retval TermInfo, err error) {
err = clownfish.TrapErr(func() {
self := (*C.lucy_LexiconReader)(clownfish.Unwrap(lr, "lr"))
fieldC := (*C.cfish_String)(clownfish.GoToClownfish(field, unsafe.Pointer(C.CFISH_STRING), false))
defer C.cfish_decref(unsafe.Pointer(fieldC))
termC := (*C.cfish_Obj)(clownfish.GoToClownfish(term, unsafe.Pointer(C.CFISH_OBJ), true))
defer C.cfish_decref(unsafe.Pointer(termC))
retvalCF := C.LUCY_LexReader_Fetch_Term_Info(self, fieldC, termC)
if retvalCF != nil {
retval = clownfish.ToGo(unsafe.Pointer(retvalCF)).(TermInfo)
}
})
return retval, err
}
开发者ID:rlugojr,项目名称:lucy,代码行数:14,代码来源:index.go
示例8: PostingList
func (p *PostingListReaderIMP) PostingList(field string, term interface{}) (retval PostingList, err error) {
err = clownfish.TrapErr(func() {
self := (*C.lucy_PostingListReader)(clownfish.Unwrap(p, "p"))
fieldC := (*C.cfish_String)(clownfish.GoToClownfish(field, unsafe.Pointer(C.CFISH_STRING), false))
defer C.cfish_decref(unsafe.Pointer(fieldC))
termC := (*C.cfish_Obj)(clownfish.GoToClownfish(term, unsafe.Pointer(C.CFISH_OBJ), true))
defer C.cfish_decref(unsafe.Pointer(termC))
retvalCF := C.LUCY_PListReader_Posting_List(self, fieldC, termC)
if retvalCF != nil {
retval = clownfish.ToGo(unsafe.Pointer(retvalCF)).(PostingList)
}
})
return retval, err
}
开发者ID:rlugojr,项目名称:lucy,代码行数:14,代码来源:index.go
示例9: fetchEntry
func fetchEntry(ivars *C.lucy_InverterIVARS, fieldGo string) *C.lucy_InverterEntry {
field := (*C.cfish_String)(clownfish.GoToClownfish(fieldGo,
unsafe.Pointer(C.CFISH_STRING), false))
defer C.cfish_decref(unsafe.Pointer(field))
schema := ivars.schema
fieldNum := C.LUCY_Seg_Field_Num(ivars.segment, field)
if fieldNum == 0 {
// This field seems not to be in the segment yet. Try to find it in
// the Schema.
if C.LUCY_Schema_Fetch_Type(schema, field) != nil {
// The field is in the Schema. Get a field num from the Segment.
fieldNum = C.LUCY_Seg_Add_Field(ivars.segment, field)
} else {
// We've truly failed to find the field. The user must
// not have spec'd it.
fieldGo := clownfish.CFStringToGo(unsafe.Pointer(field))
err := clownfish.NewErr("Unknown field name: '" + fieldGo + "'")
panic(err)
}
}
entry := C.CFISH_Vec_Fetch(ivars.entry_pool, C.size_t(fieldNum))
if entry == nil {
newEntry := C.lucy_InvEntry_new(schema, field, fieldNum)
C.CFISH_Vec_Store(ivars.entry_pool, C.size_t(fieldNum),
(*C.cfish_Obj)(unsafe.Pointer(entry)))
return newEntry
}
return (*C.lucy_InverterEntry)(unsafe.Pointer(entry))
}
开发者ID:lazycrazyowl,项目名称:lucy,代码行数:29,代码来源:lucy.go
示例10: Split
func (a *AnalyzerIMP) Split(text string) []string {
self := (*C.lucy_Analyzer)(clownfish.Unwrap(a, "a"))
input := (*C.cfish_String)(clownfish.GoToClownfish(text, unsafe.Pointer(C.CFISH_STRING), false))
defer C.cfish_decref(unsafe.Pointer(input))
retvalCF := C.LUCY_Analyzer_Split(self, input)
defer C.cfish_decref(unsafe.Pointer(retvalCF))
return vecToStringSlice(retvalCF)
}
开发者ID:lazycrazyowl,项目名称:lucy,代码行数:8,代码来源:analysis.go
示例11: Consolidate
func (f *FolderIMP) Consolidate(path string) error {
return 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))
C.LUCY_Folder_Consolidate(self, pathC)
})
}
开发者ID:rlugojr,项目名称:lucy,代码行数:8,代码来源:store.go
示例12: AddIndex
func (obj *IndexerIMP) AddIndex(index interface{}) error {
return clownfish.TrapErr(func() {
self := (*C.lucy_Indexer)(clownfish.Unwrap(obj, "obj"))
indexC := (*C.cfish_Obj)(clownfish.GoToClownfish(index, unsafe.Pointer(C.CFISH_OBJ), false))
defer C.cfish_decref(unsafe.Pointer(indexC))
C.LUCY_Indexer_Add_Index(self, indexC)
})
}
开发者ID:rlugojr,项目名称:lucy,代码行数:8,代码来源:index.go
示例13: GOLUCY_Doc_Serialize
//export GOLUCY_Doc_Serialize
func GOLUCY_Doc_Serialize(d *C.lucy_Doc, outstream *C.lucy_OutStream) {
ivars := C.lucy_Doc_IVARS(d)
fields := fetchDocFields(d)
hash := clownfish.GoToClownfish(fields, unsafe.Pointer(C.CFISH_HASH), false)
defer C.cfish_decref(hash)
C.lucy_Freezer_serialize_hash((*C.cfish_Hash)(hash), outstream)
C.LUCY_OutStream_Write_C32(outstream, C.uint32_t(ivars.doc_id))
}
开发者ID:lazycrazyowl,项目名称:lucy,代码行数:9,代码来源:lucy.go
示例14: WriteDelta
func (s *StepperIMP) WriteDelta(outstream OutStream, value interface{}) error {
return clownfish.TrapErr(func() {
self := (*C.lucy_Stepper)(clownfish.Unwrap(s, "s"))
outstreamCF := (*C.lucy_OutStream)(clownfish.Unwrap(outstream, "outstream"))
valueCF := (*C.cfish_Obj)(clownfish.GoToClownfish(value, unsafe.Pointer(C.CFISH_OBJ), false))
defer C.cfish_decref(unsafe.Pointer(valueCF))
C.LUCY_Stepper_Write_Delta(self, outstreamCF, valueCF)
})
}
开发者ID:rlugojr,项目名称:lucy,代码行数:9,代码来源:util.go
示例15: 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
示例16: OpenIndexSearcher
func OpenIndexSearcher(index interface{}) (obj IndexSearcher, err error) {
indexC := (*C.cfish_Obj)(clownfish.GoToClownfish(index, unsafe.Pointer(C.CFISH_OBJ), false))
defer C.cfish_decref(unsafe.Pointer(indexC))
err = clownfish.TrapErr(func() {
cfObj := C.lucy_IxSearcher_new(indexC)
obj = WRAPIndexSearcher(unsafe.Pointer(cfObj))
})
return obj, err
}
开发者ID:rlugojr,项目名称:lucy,代码行数:9,代码来源:search.go
示例17: WriteFile
func (s *SnapshotIMP) WriteFile(folder Folder, path string) error {
return clownfish.TrapErr(func() {
self := (*C.lucy_Snapshot)(clownfish.Unwrap(s, "s"))
folderC := (*C.lucy_Folder)(clownfish.Unwrap(folder, "folder"))
pathC := (*C.cfish_String)(clownfish.GoToClownfish(path, unsafe.Pointer(C.CFISH_STRING), false))
defer C.cfish_decref(unsafe.Pointer(pathC))
C.LUCY_Snapshot_Write_File(self, folderC, pathC)
})
}
开发者ID:rlugojr,项目名称:lucy,代码行数:9,代码来源:index.go
示例18: Search
func (s *SimpleIMP) Search(query string, offset, numWanted int) (totalHits int, err error) {
err = clownfish.TrapErr(func() {
self := (*C.lucy_Simple)(clownfish.Unwrap(s, "s"))
qStringC := (*C.cfish_String)(clownfish.GoToClownfish(query, unsafe.Pointer(C.CFISH_STRING), false))
defer C.cfish_decref(unsafe.Pointer(qStringC))
totalHits = int(C.LUCY_Simple_Search(self, qStringC, C.uint32_t(offset), C.uint32_t(numWanted)))
})
return totalHits, err
}
开发者ID:rectang,项目名称:lucy,代码行数:9,代码来源:simple.go
示例19: Find
func (s *SortCacheIMP) Find(term interface{}) (retval int32, err error) {
err = clownfish.TrapErr(func() {
self := (*C.lucy_SortCache)(clownfish.Unwrap(s, "s"))
termCF := (*C.cfish_Obj)(clownfish.GoToClownfish(term, unsafe.Pointer(C.CFISH_OBJ), true))
defer C.cfish_decref(unsafe.Pointer(termCF))
retvalCF := C.LUCY_SortCache_Find(self, termCF)
retval = int32(retvalCF)
})
return retval, err
}
开发者ID:rlugojr,项目名称:lucy,代码行数:10,代码来源:index.go
示例20: 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
注:本文中的git-wip-us/apache/org/repos/asf/lucy-clownfish/git/runtime/go/clownfish.GoToClownfish函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论