lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [04/16] lucy git commit: Make NewANDQuery, NewORQuery take []Query.
Date Fri, 11 Sep 2015 22:00:29 GMT
Make NewANDQuery, NewORQuery take []Query.

Have the Go bindings for the ANDQuery and ORQuery constructors take a
slice of Query rather than a slice of empty interface.


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/a28275ec
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/a28275ec
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/a28275ec

Branch: refs/heads/master
Commit: a28275ec8d7dd064f033afd81cfa43e3dd16d4ac
Parents: 71a17b0
Author: Marvin Humphrey <marvin@rectangular.com>
Authored: Wed Sep 9 18:17:53 2015 -0700
Committer: Marvin Humphrey <marvin@rectangular.com>
Committed: Wed Sep 9 18:21:15 2015 -0700

----------------------------------------------------------------------
 go/build.go       |  8 ++++++++
 go/lucy/search.go | 22 ++++++++++++++++++++++
 2 files changed, 30 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/a28275ec/go/build.go
----------------------------------------------------------------------
diff --git a/go/build.go b/go/build.go
index 43957d2..67672eb 100644
--- a/go/build.go
+++ b/go/build.go
@@ -159,6 +159,14 @@ func specClasses(parcel *cfc.Parcel) {
 	hitsBinding.SpecMethod("", "Error() error")
 	hitsBinding.SetSuppressStruct(true)
 	hitsBinding.Register()
+
+	andQueryBinding := cfc.NewGoClass(parcel, "Lucy::Search::ANDQuery")
+	andQueryBinding.SetSuppressCtor(true)
+	andQueryBinding.Register()
+
+	orQueryBinding := cfc.NewGoClass(parcel, "Lucy::Search::ORQuery")
+	orQueryBinding.SetSuppressCtor(true)
+	orQueryBinding.Register()
 }
 
 func build() {

http://git-wip-us.apache.org/repos/asf/lucy/blob/a28275ec/go/lucy/search.go
----------------------------------------------------------------------
diff --git a/go/lucy/search.go b/go/lucy/search.go
index 3335252..8d18ea9 100644
--- a/go/lucy/search.go
+++ b/go/lucy/search.go
@@ -22,6 +22,8 @@ package lucy
 #include "Lucy/Search/IndexSearcher.h"
 #include "Lucy/Search/Query.h"
 #include "Lucy/Search/Searcher.h"
+#include "Lucy/Search/ANDQuery.h"
+#include "Lucy/Search/ORQuery.h"
 #include "Lucy/Document/HitDoc.h"
 #include "Clownfish/Hash.h"
 #include "Clownfish/HashIterator.h"
@@ -161,3 +163,23 @@ func (obj *HitsIMP) Next(hit interface{}) bool {
 func (obj *HitsIMP) Error() error {
 	return obj.err
 }
+
+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))
+}
+
+func NewORQuery(children []Query) ORQuery {
+	vec := clownfish.NewVector(len(children))
+	for _, child := range children {
+		vec.Push(child)
+	}
+	childrenC := (*C.cfish_Vector)(unsafe.Pointer(vec.TOPTR()))
+	cfObj := C.lucy_ORQuery_new(childrenC)
+	return WRAPORQuery(unsafe.Pointer(cfObj))
+}


Mime
View raw message