Skip to content

Commit

Permalink
Rename 2 of the FTS index management functions to correctly match
Browse files Browse the repository at this point in the history
the rfc

Change-Id: I36220afe2d2550502ac5815092c220dfb36a734b
Reviewed-on: http://review.couchbase.org/94343
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Charles Dixon <chvckd@gmail.com>
  • Loading branch information
chvck committed May 21, 2018
1 parent 40eafe8 commit eae797f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions clustermgr_searchindex.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ func (sim *SearchIndexManager) doSearchIndexRequest(method, uri, contentType, ca
return sim.cm.httpCli.Do(req)
}

// GetIndexes retrieves all of the FTS indexes for the cluster.
func (sim *SearchIndexManager) GetIndexes() ([]interface{}, error) {
// GetAllIndexDefinitions retrieves all of the FTS indexes for the cluster.
func (sim *SearchIndexManager) GetAllIndexDefinitions() ([]interface{}, error) {
res, err := sim.doSearchIndexRequest("GET", "/api/index", "", "", nil)
if err != nil {
return nil, err
Expand All @@ -134,8 +134,8 @@ func (sim *SearchIndexManager) GetIndexes() ([]interface{}, error) {
return indexes, nil
}

// GetIndex retrieves a specific FTS index by name.
func (sim *SearchIndexManager) GetIndex(indexName string) (interface{}, error) {
// GetIndexDefinition retrieves a specific FTS index by name.
func (sim *SearchIndexManager) GetIndexDefinition(indexName string) (interface{}, error) {
uri := fmt.Sprintf("/api/index/%s", indexName)
res, err := sim.doSearchIndexRequest("GET", uri, "", "", nil)
if err != nil {
Expand Down
16 changes: 8 additions & 8 deletions clustermgr_searchindex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func TestCreateIndexNoSourceType(t *testing.T) {
}
}

//func TestGetIndexes(t *testing.T) {
//func TestGetAllIndexDefinitions(t *testing.T) {
// manager := globalCluster.Manager("", "")
// searchManager := manager.SearchIndexManager()
//
Expand All @@ -155,32 +155,32 @@ func TestCreateIndexNoSourceType(t *testing.T) {
// createSimpleIndex(t, "test_search_index_1", searchManager)
// createSimpleIndex(t, "test_search_index_2", searchManager)
//
// indexes, err := searchManager.GetIndexes()
// indexes, err := searchManager.GetAllIndexDefinitions()
// if err != nil {
// t.Fatalf("Failed to GetIndexes %v", err)
// t.Fatalf("Failed to GetAllIndexDefinitions %v", err)
// }
//
// if len(indexes) != 2 {
// t.Fatalf("GetIndexes returned incorrect number of indexes, expected 2 but was %d", len(indexes))
// t.Fatalf("GetAllIndexDefinitions returned incorrect number of indexes, expected 2 but was %d", len(indexes))
// }
//}
//
//func TestGetIndex(t *testing.T) {
//func TestGetIndexDefinition(t *testing.T) {
// manager := globalCluster.Manager("", "")
// searchManager := manager.SearchIndexManager()
//
// expectedIdxName := "test_search_index_1"
// defer deleteIndex(t, expectedIdxName, searchManager)
// createSimpleIndex(t, expectedIdxName, searchManager)
//
// rawIndex, err := searchManager.GetIndex(expectedIdxName)
// rawIndex, err := searchManager.GetIndexDefinition(expectedIdxName)
// if err != nil {
// t.Fatalf("Failed to GetIndex %v", err)
// t.Fatalf("Failed to GetIndexDefinition %v", err)
// }
//
// index := rawIndex.(map[string]interface{})
// if index["name"] != expectedIdxName {
// t.Fatalf("GetIndex returned incorrect index, expected %s, was %v", expectedIdxName, index)
// t.Fatalf("GetIndexDefinition returned incorrect index, expected %s, was %v", expectedIdxName, index)
// }
//}
//
Expand Down

0 comments on commit eae797f

Please sign in to comment.