Doc, HitDoc constructors Go bindings. Add `NewHitDoc`, move `NewDoc`.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/900fc89e Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/900fc89e Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/900fc89e Branch: refs/heads/master Commit: 900fc89ed074ad9a126e959108ec3573efc1cb31 Parents: 91d34ea Author: Marvin Humphrey <[email protected]> Authored: Fri Sep 25 17:16:08 2015 -0700 Committer: Marvin Humphrey <[email protected]> Committed: Mon Sep 28 12:54:38 2015 -0700 ---------------------------------------------------------------------- go/lucy/document.go | 34 ++++++++++++++++++++++++++++++++++ go/lucy/lucy.go | 5 ----- 2 files changed, 34 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/900fc89e/go/lucy/document.go ---------------------------------------------------------------------- diff --git a/go/lucy/document.go b/go/lucy/document.go new file mode 100644 index 0000000..02a8f82 --- /dev/null +++ b/go/lucy/document.go @@ -0,0 +1,34 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package lucy + +/* +#include "Lucy/Document/Doc.h" +#include "Lucy/Document/HitDoc.h" +*/ +import "C" +import "unsafe" + +func NewDoc(docID int32) Doc { + retvalCF := C.lucy_Doc_new(nil, C.int32_t(docID)) + return WRAPDoc(unsafe.Pointer(retvalCF)) +} + +func NewHitDoc(docID int32, score float32) HitDoc { + retvalCF := C.lucy_HitDoc_new(nil, C.int32_t(docID), C.float(score)) + return WRAPHitDoc(unsafe.Pointer(retvalCF)) +} http://git-wip-us.apache.org/repos/asf/lucy/blob/900fc89e/go/lucy/lucy.go ---------------------------------------------------------------------- diff --git a/go/lucy/lucy.go b/go/lucy/lucy.go index 37d7f1c..e67ead2 100644 --- a/go/lucy/lucy.go +++ b/go/lucy/lucy.go @@ -249,11 +249,6 @@ func GOLUCY_RegexTokenizer_Tokenize_Utf8(rt *C.lucy_RegexTokenizer, str *C.char, } } -func NewDoc(docID int32) Doc { - retvalCF := C.lucy_Doc_new(nil, C.int32_t(docID)) - return WRAPDoc(unsafe.Pointer(retvalCF)) -} - //export GOLUCY_Doc_init func GOLUCY_Doc_init(d *C.lucy_Doc, fields unsafe.Pointer, docID C.int32_t) *C.lucy_Doc { ivars := C.lucy_Doc_IVARS(d)
