Exemplo n.º 1
0
func (td *TopDocsIMP) SetMatchDocs(matchDocs []MatchDoc) {
	self := (*C.lucy_TopDocs)(clownfish.Unwrap(td, "td"))
	vec := clownfish.NewVector(len(matchDocs))
	for _, matchDoc := range matchDocs {
		vec.Push(matchDoc)
	}
	C.LUCY_TopDocs_Set_Match_Docs(self, (*C.cfish_Vector)(clownfish.Unwrap(vec, "matchDocs")))
}
Exemplo n.º 2
0
//export GOLUCY_Doc_Field_Names
func GOLUCY_Doc_Field_Names(d *C.lucy_Doc) *C.cfish_Vector {
	fields := fetchDocFields(d)
	vec := clownfish.NewVector(len(fields))
	for key, _ := range fields {
		vec.Push(key)
	}
	return (*C.cfish_Vector)(C.cfish_incref(clownfish.Unwrap(vec, "vec")))
}
Exemplo n.º 3
0
func NewSortSpec(rules []SortRule) SortSpec {
	vec := clownfish.NewVector(len(rules))
	for _, rule := range rules {
		vec.Push(rule)
	}
	cfObj := C.lucy_SortSpec_new((*C.cfish_Vector)(clownfish.Unwrap(vec, "rules")))
	return WRAPSortSpec(unsafe.Pointer(cfObj))
}
Exemplo n.º 4
0
func NewPolyAnalyzer(children []Analyzer) PolyAnalyzer {
	vec := clownfish.NewVector(len(children))
	for i := 0; i < len(children); i++ {
		vec.Push(children[i])
	}
	retvalCF := C.lucy_PolyAnalyzer_new(nil, (*C.cfish_Vector)(clownfish.Unwrap(vec, "vec")))
	return WRAPPolyAnalyzer(unsafe.Pointer(retvalCF))
}
Exemplo n.º 5
0
func NewORMatcher(children []Matcher) ORMatcher {
	vec := clownfish.NewVector(len(children))
	for _, child := range children {
		vec.Push(child)
	}
	childrenC := (*C.cfish_Vector)(unsafe.Pointer(vec.TOPTR()))
	cfObj := C.lucy_ORMatcher_new(childrenC)
	return WRAPORMatcher(unsafe.Pointer(cfObj))
}
Exemplo n.º 6
0
func NewANDQuery(children []Query) ANDQuery {
	vec := clownfish.NewVector(len(children))
	for _, child := range children {
		vec.Push(child)
	}
	childrenC := (*C.cfish_Vector)(unsafe.Pointer(vec.TOPTR()))
	cfObj := C.lucy_ANDQuery_new(childrenC)
	return WRAPANDQuery(unsafe.Pointer(cfObj))
}
Exemplo n.º 7
0
func NewTopDocs(matchDocs []MatchDoc, totalHits uint32) TopDocs {
	vec := clownfish.NewVector(len(matchDocs))
	for _, matchDoc := range matchDocs {
		vec.Push(matchDoc)
	}
	cfObj := C.lucy_TopDocs_new(((*C.cfish_Vector)(clownfish.Unwrap(vec, "matchDocs"))),
		C.uint32_t(totalHits))
	return WRAPTopDocs(unsafe.Pointer(cfObj))
}
Exemplo n.º 8
0
func NewSeriesMatcher(matchers []Matcher, offsets []int32) SeriesMatcher {
	vec := clownfish.NewVector(len(matchers))
	for _, child := range matchers {
		vec.Push(child)
	}
	i32arr := NewI32Array(offsets)
	cfObj := C.lucy_SeriesMatcher_new(((*C.cfish_Vector)(clownfish.Unwrap(vec, "matchers"))),
		((*C.lucy_I32Array)(clownfish.Unwrap(i32arr, "offsets"))))
	return WRAPSeriesMatcher(unsafe.Pointer(cfObj))
}
Exemplo n.º 9
0
func NewORScorer(children []Matcher, sim Similarity) ORScorer {
	simC := (*C.lucy_Similarity)(clownfish.UnwrapNullable(sim))
	vec := clownfish.NewVector(len(children))
	for _, child := range children {
		vec.Push(child)
	}
	childrenC := (*C.cfish_Vector)(unsafe.Pointer(vec.TOPTR()))
	cfObj := C.lucy_ORScorer_new(childrenC, simC)
	return WRAPORScorer(unsafe.Pointer(cfObj))
}