diff --git a/docs/old_build_script.txt b/docs/old_build_script.txt new file mode 100644 index 00000000..2314cd96 --- /dev/null +++ b/docs/old_build_script.txt @@ -0,0 +1,29 @@ +old build script +# remove old icu +sudo apt-get -y remove libicu48 + +# install snappy +sudo apt-get -y install libsnappy-dev + +# install newer icu +curl -o /tmp/icu4c-53_1-RHEL6-x64.tgz http://download.icu-project.org/files/icu4c/53.1/icu4c-53_1-RHEL6-x64.tgz +sudo tar zxvf /tmp/icu4c-53_1-RHEL6-x64.tgz -C / + +# install leveldb +curl -O https://leveldb.googlecode.com/files/leveldb-1.15.0.tar.gz +tar zxvf leveldb-1.15.0.tar.gz +cd leveldb-1.15.0 +make +sudo cp --preserve=links libleveldb.* /usr/local/lib +sudo cp -r include/leveldb /usr/local/include/ +sudo ldconfig +cd .. + +#install cld2 +cd analysis/token_filters/cld2 +svn checkout http://cld2.googlecode.com/svn/trunk/ cld2-read-only +cd cld2-read-only/internal/ +./compile_libs.sh +sudo cp *.so /usr/local/lib +sudo ldconfig +cd ../../../../.. \ No newline at end of file diff --git a/docs/project-code-coverage.sh b/docs/project-code-coverage.sh index 9a2791bc..6b6e7a68 100755 --- a/docs/project-code-coverage.sh +++ b/docs/project-code-coverage.sh @@ -38,6 +38,11 @@ cat acc.out integration-acc.out | go run docs/merge-coverprofile.go > merged.out if [ -n "$COVERALLS" ] then goveralls -service drone.io -coverprofile=merged.out -repotoken $COVERALLS +fi + +if [ -n "$COVERHTML" ] +then + go tool cover -html=merged.out fi rm -rf ./profile.out diff --git a/index_test.go b/index_test.go index 16205112..f2e6b43b 100644 --- a/index_test.go +++ b/index_test.go @@ -115,6 +115,39 @@ func TestCrud(t *testing.T) { if string(val) != "7" { t.Errorf("expected '7', got '%s'", val) } + + // close the index, open it again, and try some more things + index.Close() + + index, err = Open("testidx") + if err != nil { + t.Fatal(err) + } + + count, err := index.DocCount() + if err != nil { + t.Fatal(err) + } + if count != 2 { + t.Errorf("expected doc count 2, got %d", count) + } + + doc, err := index.Document("a") + if err != nil { + t.Fatal(err) + } + if doc == nil { + t.Errorf("expected doc not nil, got nil") + } + foundNameField := false + for _, field := range doc.Fields { + if field.Name() == "name" && string(field.Value()) == "marty" { + foundNameField = true + } + } + if !foundNameField { + t.Errorf("expected to find field named 'name' with value 'marty'") + } } func TestIndexCreateNewOverExisting(t *testing.T) {