예제 #1
0
파일: index.go 프로젝트: rlugojr/lucy
func (obj *IndexerIMP) DeleteByQuery(query Query) error {
	return clownfish.TrapErr(func() {
		self := (*C.lucy_Indexer)(clownfish.Unwrap(obj, "obj"))
		queryC := (*C.lucy_Query)(clownfish.Unwrap(query, "query"))
		C.LUCY_Indexer_Delete_By_Query(self, queryC)
	})
}
예제 #2
0
파일: index.go 프로젝트: kidaa/lucy
func OpenIndexer(args *OpenIndexerArgs) (obj Indexer, err error) {
	var schemaC *C.lucy_Schema = nil
	if args.Schema != nil {
		schemaC = (*C.lucy_Schema)(unsafe.Pointer(args.Schema.TOPTR()))
	}
	switch args.Index.(type) {
	case string:
	default:
		panic("TODO: support Folder")
	}
	ixLoc := clownfish.NewString(args.Index.(string))
	var managerC *C.lucy_IndexManager = nil
	if args.Manager != nil {
		managerC = (*C.lucy_IndexManager)(unsafe.Pointer(args.Manager.TOPTR()))
	}
	var flags int32
	if args.Create {
		flags = flags | int32(C.lucy_Indexer_CREATE)
	}
	if args.Truncate {
		flags = flags | int32(C.lucy_Indexer_TRUNCATE)
	}
	err = clownfish.TrapErr(func() {
		cfObj := C.lucy_Indexer_new(schemaC,
			(*C.cfish_Obj)(unsafe.Pointer(ixLoc.TOPTR())),
			managerC, C.int32_t(flags))
		obj = WRAPIndexer(unsafe.Pointer(cfObj))
	})
	return obj, err
}
예제 #3
0
파일: util.go 프로젝트: rlugojr/lucy
func (s *StepperIMP) readRecord(instream InStream) error {
	return clownfish.TrapErr(func() {
		self := (*C.lucy_Stepper)(clownfish.Unwrap(s, "s"))
		instreamCF := (*C.lucy_InStream)(clownfish.Unwrap(instream, "instream"))
		C.LUCY_Stepper_Read_Record(self, instreamCF)
	})
}
예제 #4
0
파일: store.go 프로젝트: rlugojr/lucy
func (out *OutStreamIMP) Absorb(in InStream) error {
	return clownfish.TrapErr(func() {
		self := (*C.lucy_OutStream)(clownfish.Unwrap(out, "out"))
		inStreamC := (*C.lucy_InStream)(clownfish.Unwrap(in, "in"))
		C.LUCY_OutStream_Absorb(self, inStreamC)
	})
}
예제 #5
0
파일: index.go 프로젝트: rlugojr/lucy
func (d *DataWriterIMP) DeleteSegment(reader SegReader) error {
	return clownfish.TrapErr(func() {
		self := (*C.lucy_DataWriter)(clownfish.Unwrap(d, "d"))
		readerCF := (*C.lucy_SegReader)(clownfish.Unwrap(reader, "reader"))
		C.LUCY_DataWriter_Delete_Segment(self, readerCF)
	})
}
예제 #6
0
파일: index.go 프로젝트: rlugojr/lucy
func (d *DeletionsWriterIMP) DeleteByQuery(query Query) error {
	return clownfish.TrapErr(func() {
		self := (*C.lucy_DeletionsWriter)(clownfish.Unwrap(d, "d"))
		queryCF := (*C.lucy_Query)(clownfish.Unwrap(query, "query"))
		C.LUCY_DelWriter_Delete_By_Query(self, queryCF)
	})
}
예제 #7
0
파일: index.go 프로젝트: rlugojr/lucy
func (obj *IndexerIMP) addDocObj(doc Doc, boost float32) error {
	self := (*C.lucy_Indexer)(clownfish.Unwrap(obj, "obj"))
	d := (*C.lucy_Doc)(clownfish.Unwrap(doc, "doc"))
	return clownfish.TrapErr(func() {
		C.LUCY_Indexer_Add_Doc(self, d, C.float(boost))
	})
}
예제 #8
0
파일: index.go 프로젝트: rlugojr/lucy
func (s *SegmentIMP) ReadFile(folder Folder) error {
	return clownfish.TrapErr(func() {
		self := (*C.lucy_Segment)(clownfish.Unwrap(s, "s"))
		folderC := (*C.lucy_Folder)(clownfish.Unwrap(folder, "folder"))
		C.LUCY_Seg_Read_File(self, folderC)
	})
}
예제 #9
0
파일: index.go 프로젝트: rlugojr/lucy
func (s *SegWriterIMP) AddDoc(doc Doc, boost float32) error {
	return clownfish.TrapErr(func() {
		self := (*C.lucy_SegWriter)(clownfish.Unwrap(s, "s"))
		docCF := (*C.lucy_Doc)(clownfish.Unwrap(doc, "doc"))
		C.LUCY_SegWriter_Add_Doc(self, docCF, C.float(boost))
	})
}
예제 #10
0
파일: index.go 프로젝트: rlugojr/lucy
func (d *DataWriterIMP) addInvertedDoc(inverter Inverter, docId int32) error {
	return clownfish.TrapErr(func() {
		self := (*C.lucy_DataWriter)(clownfish.Unwrap(d, "d"))
		inverterCF := (*C.lucy_Inverter)(clownfish.Unwrap(inverter, "inverter"))
		C.LUCY_DataWriter_Add_Inverted_Doc(self, inverterCF, C.int32_t(docId))
	})
}
예제 #11
0
파일: store.go 프로젝트: rlugojr/lucy
func (in *InStreamIMP) ReadCU32() (uint32, error) {
	var retval uint32
	err := clownfish.TrapErr(func() {
		self := (*C.lucy_InStream)(clownfish.Unwrap(in, "in"))
		retval = uint32(C.LUCY_InStream_Read_CU32(self))
	})
	return retval, err
}
예제 #12
0
파일: index.go 프로젝트: rlugojr/lucy
func (d *DocReaderIMP) FetchDoc(docID int32) (doc HitDoc, err error) {
	err = clownfish.TrapErr(func() {
		self := (*C.lucy_DocReader)(clownfish.Unwrap(d, "d"))
		docC := C.LUCY_DocReader_Fetch_Doc(self, C.int32_t(docID))
		doc = WRAPHitDoc(unsafe.Pointer(docC))
	})
	return doc, err
}
예제 #13
0
파일: index.go 프로젝트: rlugojr/lucy
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)
	})
}
예제 #14
0
파일: search.go 프로젝트: rlugojr/lucy
func (s *SearcherIMP) fetchDocVec(docID int32) (dv DocVector, err error) {
	err = clownfish.TrapErr(func() {
		self := (*C.lucy_Searcher)(clownfish.Unwrap(s, "s"))
		dvC := C.LUCY_Searcher_Fetch_Doc_Vec(self, C.int32_t(docID))
		dv = WRAPDocVector(unsafe.Pointer(dvC))
	})
	return dv, err
}
예제 #15
0
파일: store.go 프로젝트: rlugojr/lucy
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)
	})
}
예제 #16
0
파일: store.go 프로젝트: rlugojr/lucy
func (in *InStreamIMP) ReadF64() (float64, error) {
	var retval float64
	err := clownfish.TrapErr(func() {
		self := (*C.lucy_InStream)(clownfish.Unwrap(in, "in"))
		retval = float64(C.LUCY_InStream_Read_F64(self))
	})
	return retval, err
}
예제 #17
0
파일: index.go 프로젝트: rlugojr/lucy
func (s *SortCacheIMP) Ordinal(docId int32) (retval int32, err error) {
	err = clownfish.TrapErr(func() {
		self := (*C.lucy_SortCache)(clownfish.Unwrap(s, "s"))
		retvalCF := C.LUCY_SortCache_Ordinal(self, C.int32_t(docId))
		retval = int32(retvalCF)
	})
	return retval, err
}
예제 #18
0
파일: index.go 프로젝트: rlugojr/lucy
func (h *HighlightReaderIMP) FetchDocVec(docID int32) (retval DocVector, err error) {
	err = clownfish.TrapErr(func() {
		self := (*C.lucy_HighlightReader)(clownfish.Unwrap(h, "h"))
		retvalCF := C.LUCY_HLReader_Fetch_Doc_Vec(self, C.int32_t(docID))
		retval = WRAPDocVector(unsafe.Pointer(retvalCF))
	})
	return retval, err
}
예제 #19
0
파일: store.go 프로젝트: rlugojr/lucy
func (in *InStreamIMP) ReadI8() (int8, error) {
	var retval int8
	err := clownfish.TrapErr(func() {
		self := (*C.lucy_InStream)(clownfish.Unwrap(in, "in"))
		retval = int8(C.LUCY_InStream_Read_I8(self))
	})
	return retval, err
}
예제 #20
0
파일: index.go 프로젝트: rlugojr/lucy
func (s *SortCacheIMP) Value(ord int32) (retval interface{}, err error) {
	err = clownfish.TrapErr(func() {
		self := (*C.lucy_SortCache)(clownfish.Unwrap(s, "s"))
		retvalCF := C.LUCY_SortCache_Value(self, C.int32_t(ord))
		defer C.cfish_decref(unsafe.Pointer(retvalCF))
		retval = clownfish.ToGo(unsafe.Pointer(retvalCF))
	})
	return retval, err
}
예제 #21
0
파일: store.go 프로젝트: rlugojr/lucy
func (out *OutStreamIMP) WriteString(content string) error {
	return clownfish.TrapErr(func() {
		self := (*C.lucy_OutStream)(clownfish.Unwrap(out, "out"))
		octets := C.CString(content)
		defer C.free(unsafe.Pointer(octets))
		size := len(content)
		C.LUCY_OutStream_Write_String(self, octets, C.size_t(size))
	})
}
예제 #22
0
파일: index.go 프로젝트: rlugojr/lucy
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)
	})
}
예제 #23
0
파일: simple.go 프로젝트: rectang/lucy
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
}
예제 #24
0
파일: search.go 프로젝트: rlugojr/lucy
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
}
예제 #25
0
파일: index.go 프로젝트: rlugojr/lucy
func (d *DataWriterIMP) MergeSegment(reader SegReader, docMap []int32) error {
	return clownfish.TrapErr(func() {
		self := (*C.lucy_DataWriter)(clownfish.Unwrap(d, "d"))
		readerCF := (*C.lucy_SegReader)(clownfish.Unwrap(reader, "reader"))
		docMapConv := NewI32Array(docMap)
		docMapCF := (*C.lucy_I32Array)(clownfish.UnwrapNullable(docMapConv))
		C.LUCY_DataWriter_Merge_Segment(self, readerCF, docMapCF)
	})
}
예제 #26
0
파일: util.go 프로젝트: rlugojr/lucy
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)
	})
}
예제 #27
0
파일: index.go 프로젝트: rlugojr/lucy
func (d *DeletionsWriterIMP) generateDocMap(deletions Matcher, docMax int32, offset int32) (retval []int32, err error) {
	err = clownfish.TrapErr(func() {
		self := (*C.lucy_DeletionsWriter)(clownfish.Unwrap(d, "d"))
		deletionsCF := (*C.lucy_Matcher)(clownfish.Unwrap(deletions, "deletions"))
		retvalCF := C.LUCY_DelWriter_Generate_Doc_Map(self, deletionsCF, C.int32_t(docMax), C.int32_t(offset))
		defer C.cfish_decref(unsafe.Pointer(retvalCF))
		retval = i32ArrayToSlice(retvalCF)
	})
	return retval, err
}
예제 #28
0
파일: index.go 프로젝트: rlugojr/lucy
func OpenBackgroundMerger(index interface{}, manager IndexManager) (bgm BackgroundMerger, 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))
		managerC := (*C.lucy_IndexManager)(clownfish.UnwrapNullable(manager))
		cfObj := C.lucy_BGMerger_new(indexC, managerC)
		bgm = WRAPBackgroundMerger(unsafe.Pointer(cfObj))
	})
	return bgm, err
}
예제 #29
0
파일: index.go 프로젝트: rlugojr/lucy
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
}
예제 #30
0
파일: index.go 프로젝트: rlugojr/lucy
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
}