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


Golang clownfish.GoToClownfish函數代碼示例

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


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


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