Skip to content

Commit

Permalink
MB-29963: Set indexType to upsidedown.Name (default indexType)
Browse files Browse the repository at this point in the history
+ Also do not display kvStoreName in the preview if the
  indexType is 'scorch'

Change-Id: I9e0a5bfd7a7da2f671fb7cfb9cabc5385154bb94
Reviewed-on: http://review.couchbase.org/94172
Reviewed-by: Marty Schoch <marty.schoch@gmail.com>
Well-Formed: Build Bot <build@couchbase.com>
Tested-by: Abhinav Dangeti <abhinav@couchbase.com>
  • Loading branch information
abhinavdangeti committed Jun 6, 2018
1 parent 03a97f8 commit eac8800
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 11 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ PROJECT (cbft)
# GODEPSDIR - should point to a Go workspace directory containing all
# transitive Go dependencies

SET (FTS_DEFAULT_KVSTORE "mossStore_default_kvstore")
SET (FTS_DEFAULT "server")

INCLUDE (FindCouchbaseGo)

GoInstall (TARGET cbft PACKAGE github.com/couchbase/cbft/cmd/cbft
GOPATH "${PROJECT_SOURCE_DIR}/../../../.." "${GODEPSDIR}"
GOTAGS "${FTS_DEFAULT_KVSTORE}"
GOTAGS "${FTS_DEFAULT}"
INSTALL_PATH bin OUTPUT cbft
GOVERSION 1.9.6)

GoInstall (TARGET cbft-bleve PACKAGE github.com/couchbase/cbft/cmd/cbft-bleve
GOPATH "${PROJECT_SOURCE_DIR}/../../../.." "${GODEPSDIR}"
GOTAGS "${FTS_DEFAULT_KVSTORE}"
GOTAGS "${FTS_DEFAULT}"
INSTALL_PATH bin OUTPUT cbft-bleve
GOVERSION 1.9.6)

Expand Down
7 changes: 4 additions & 3 deletions bleve_mossStore_default.go → bleve_config_default.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Copyright (c) 2015 Couchbase, Inc.
//
// Copyright (c) 2018 Couchbase, Inc.
// Licensed 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
Expand All @@ -10,15 +9,17 @@
// implied. See the License for the specific language governing
// permissions and limitations under the License.

// +build mossStore_default_kvstore
// +build server

package cbft

import (
"github.com/blevesearch/bleve"
"github.com/blevesearch/bleve/index/upsidedown"
)

func init() {
// install mossStore as the default kv store
bleve.Config.DefaultKVStore = "mossStore"
bleve.Config.DefaultIndexType = upsidedown.Name
}
2 changes: 1 addition & 1 deletion ns_server_static/fts/uia/fts.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,8 @@ function IndexNewCtrlFT_NS($scope, $http, $route, $state, $stateParams,
$scope.ftsStore.indexType = "upside_down";
break;
case $scope.indexStoreOptions[1]:
$scope.ftsStore.kvStoreName = "";
$scope.ftsStore.indexType = "scorch";
delete $scope.ftsStore.kvStoreName;
break;
}
}
Expand Down
7 changes: 3 additions & 4 deletions pindex_bleve.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,8 @@ type BleveParamsStore struct {
// bleve.registry.RegisterIndexType().
IndexType string `json:"indexType"`

// The kvStoreName defaults to bleve.Config.DefaultKVStore. It
// can be (and usually is in public builds) initialized to a
// default of "mossStore" via the mossStore_default_kvstore build
// tag. See also bleve.registry.RegisterKVStore().
// The kvStoreName defaults to bleve.Config.DefaultKVStore.
// See also bleve.registry.RegisterKVStore().
KvStoreName string `json:"kvStoreName"`

// The kvStoreMetricsAllow flag defaults to
Expand Down Expand Up @@ -168,6 +166,7 @@ func NewBleveParams() *BleveParams {
Mapping: bleve.NewIndexMapping(),
Store: map[string]interface{}{
"kvStoreName": bleve.Config.DefaultKVStore,
"indexType": bleve.Config.DefaultIndexType,
},
DocConfig: BleveDocumentConfig{
Mode: "type_field",
Expand Down
4 changes: 4 additions & 0 deletions pindex_bleve_rollback_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

"github.com/blevesearch/bleve"
bleveMoss "github.com/blevesearch/bleve/index/store/moss"
"github.com/blevesearch/bleve/index/upsidedown"

"encoding/json"

Expand Down Expand Up @@ -68,13 +69,16 @@ func testHandlersWithOnePartitionPrimaryFeedPartialRollbackMoss(t *testing.T,

bleveConfigDefaultKVStorePrev := bleve.Config.DefaultKVStore
bleve.Config.DefaultKVStore = "mossStore"
bleveConfigDefaultIndexTypePrev := bleve.Config.DefaultIndexType
bleve.Config.DefaultIndexType = upsidedown.Name

bleveMossRegistryCollectionOptionsFTSPrev := bleveMoss.RegistryCollectionOptions["fts"]
bleveMoss.RegistryCollectionOptions["fts"] = moss.CollectionOptions{}

defer func() {
BlevePIndexAllowMoss = BlevePIndexAllowMossPrev
bleve.Config.DefaultKVStore = bleveConfigDefaultKVStorePrev
bleve.Config.DefaultIndexType = bleveConfigDefaultIndexTypePrev
bleveMoss.RegistryCollectionOptions["fts"] = bleveMossRegistryCollectionOptionsFTSPrev
}()

Expand Down
4 changes: 4 additions & 0 deletions rest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (

"github.com/blevesearch/bleve"
bleveMoss "github.com/blevesearch/bleve/index/store/moss"
"github.com/blevesearch/bleve/index/upsidedown"
)

// Implements ManagerEventHandlers interface.
Expand Down Expand Up @@ -1586,13 +1587,16 @@ func TestHandlersWithOnePartitionPrimaryFeedRollbackMoss(t *testing.T) {

bleveConfigDefaultKVStorePrev := bleve.Config.DefaultKVStore
bleve.Config.DefaultKVStore = "mossStore"
bleveConfigDefaultIndexTypePrev := bleve.Config.DefaultIndexType
bleve.Config.DefaultIndexType = upsidedown.Name

bleveMossRegistryCollectionOptionsFTSPrev := bleveMoss.RegistryCollectionOptions["fts"]
bleveMoss.RegistryCollectionOptions["fts"] = moss.CollectionOptions{}

defer func() {
BlevePIndexAllowMoss = BlevePIndexAllowMossPrev
bleve.Config.DefaultKVStore = bleveConfigDefaultKVStorePrev
bleve.Config.DefaultIndexType = bleveConfigDefaultIndexTypePrev
bleveMoss.RegistryCollectionOptions["fts"] = bleveMossRegistryCollectionOptionsFTSPrev
}()

Expand Down

0 comments on commit eac8800

Please sign in to comment.