lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [06/13] lucy git commit: Consolidate Searcher Go bindings.
Date Tue, 24 Nov 2015 23:38:28 GMT
Consolidate Searcher Go bindings.


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

Branch: refs/heads/master
Commit: e35becd7dd804ceb103e19710f0aa85fd864e150
Parents: e101aca
Author: Marvin Humphrey <marvin@rectangular.com>
Authored: Tue Nov 10 19:28:38 2015 -0800
Committer: Marvin Humphrey <marvin@rectangular.com>
Committed: Fri Nov 20 16:43:37 2015 -0800

----------------------------------------------------------------------
 go/lucy/search.go | 33 +++------------------------------
 1 file changed, 3 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/e35becd7/go/lucy/search.go
----------------------------------------------------------------------
diff --git a/go/lucy/search.go b/go/lucy/search.go
index a8bab6f..44f5054 100644
--- a/go/lucy/search.go
+++ b/go/lucy/search.go
@@ -69,15 +69,6 @@ func OpenIndexSearcher(index interface{}) (obj IndexSearcher, err error)
{
 	return obj, err
 }
 
-func (obj *IndexSearcherIMP) Close() error {
-	return doClose(obj)
-}
-
-func (obj *IndexSearcherIMP) Hits(query interface{}, offset uint32, numWanted uint32,
-	sortSpec SortSpec) (hits Hits, err error) {
-	return doHits(obj, query, offset, numWanted, sortSpec)
-}
-
 // Read data into the supplied doc.
 func (s *SearcherIMP) ReadDoc(docID int32, doc interface{}) error {
 	self := (*C.lucy_Searcher)(clownfish.Unwrap(s, "s"))
@@ -97,14 +88,14 @@ func (s *SearcherIMP) ReadDoc(docID int32, doc interface{}) error {
 	}
 }
 
-func doClose(obj Searcher) error {
-	self := ((*C.lucy_Searcher)(unsafe.Pointer(obj.TOPTR())))
+func (s *SearcherIMP) Close() error {
 	return clownfish.TrapErr(func() {
+		self := (*C.lucy_Searcher)(clownfish.Unwrap(s, "s"))
 		C.LUCY_Searcher_Close(self)
 	})
 }
 
-func doHits(s Searcher, query interface{}, offset uint32, numWanted uint32,
+func (s *SearcherIMP) Hits(query interface{}, offset uint32, numWanted uint32,
 	sortSpec SortSpec) (hits Hits, err error) {
 	self := (*C.lucy_Searcher)(clownfish.Unwrap(s, "s"))
 	sortSpecC := (*C.lucy_SortSpec)(clownfish.UnwrapNullable(sortSpec))
@@ -118,24 +109,6 @@ func doHits(s Searcher, query interface{}, offset uint32, numWanted uint32,
 	return hits, err
 }
 
-func (obj *SearcherIMP) Close() error {
-	return doClose(obj)
-}
-
-func (obj *SearcherIMP) Hits(query interface{}, offset uint32, numWanted uint32,
-	sortSpec SortSpec) (hits Hits, err error) {
-	return doHits(obj, query, offset, numWanted, sortSpec)
-}
-
-func (obj *PolySearcherIMP) Close() error {
-	return doClose(obj)
-}
-
-func (obj *PolySearcherIMP) Hits(query interface{}, offset uint32, numWanted uint32,
-	sortSpec SortSpec) (hits Hits, err error) {
-	return doHits(obj, query, offset, numWanted, sortSpec)
-}
-
 type setScorer interface {
 	SetScore(float32)
 }


Mime
View raw message