本文整理匯總了Golang中C.cfish_decref函數的典型用法代碼示例。如果您正苦於以下問題:Golang cfish_decref函數的具體用法?Golang cfish_decref怎麽用?Golang cfish_decref使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了cfish_decref函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: 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)
}
示例2: generateProximityBoosts
func (h *HeatMapIMP) generateProximityBoosts(spans []Span) []Span {
self := (*C.lucy_HeatMap)(clownfish.Unwrap(h, "h"))
spansCF := spanSliceToVec(spans)
defer C.cfish_decref(unsafe.Pointer(spansCF))
retvalCF := C.LUCY_HeatMap_Generate_Proximity_Boosts(self, spansCF)
defer C.cfish_decref(unsafe.Pointer(retvalCF))
return vecToSpanSlice(retvalCF)
}
示例3: flattenSpans
func (h *HeatMapIMP) flattenSpans(spans []Span) []Span {
self := (*C.lucy_HeatMap)(clownfish.Unwrap(h, "h"))
spansCF := spanSliceToVec(spans)
defer C.cfish_decref(unsafe.Pointer(spansCF))
retvalCF := C.LUCY_HeatMap_Flatten_Spans(self, spansCF)
defer C.cfish_decref(unsafe.Pointer(retvalCF))
return vecToSpanSlice(retvalCF)
}
示例4: 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)
}
示例5: DeleteByTerm
func (obj *IndexerIMP) DeleteByTerm(field string, term interface{}) error {
return clownfish.TrapErr(func() {
self := (*C.lucy_Indexer)(clownfish.Unwrap(obj, "obj"))
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), false))
defer C.cfish_decref(unsafe.Pointer(termC))
C.LUCY_Indexer_Delete_By_Term(self, fieldC, termC)
})
}
示例6: 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
}
示例7: 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
}
示例8: SlurpFile
func (f *FolderIMP) SlurpFile(path string) (retval []byte, 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_Slurp_File(self, pathC)
defer C.cfish_decref(unsafe.Pointer(retvalC))
retval = clownfish.ToGo(unsafe.Pointer(retvalC)).([]byte)
})
return retval, err
}
示例9: 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
}
示例10: 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))
}
示例11: 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
}
示例12: 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
}
示例13: ListR
func (f *FolderIMP) ListR(path string) (retval []string, 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_List_R(self, pathC)
if retvalC == nil {
cfErr := C.cfish_Err_get_error()
panic(clownfish.WRAPAny(unsafe.Pointer(C.cfish_incref(unsafe.Pointer(cfErr)))).(error))
}
defer C.cfish_decref(unsafe.Pointer(retvalC))
retval = vecToStringSlice(retvalC)
})
return retval, err
}
示例14: NewMethod
func NewMethod(name string, callbackFunc unsafe.Pointer, offset uint32) Method {
nameCF := (*C.cfish_String)(goToString(name, false))
defer C.cfish_decref(unsafe.Pointer(nameCF))
methCF := C.cfish_Method_new(nameCF, C.cfish_method_t(callbackFunc),
C.uint32_t(offset))
return WRAPMethod(unsafe.Pointer(methCF))
}
示例15: 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))
}