0
0
Fork 0

fix backwards compatibility when index meta does not specify

the index type
This commit is contained in:
Marty Schoch 2015-09-25 09:56:42 -07:00
parent ad82b4b33e
commit 1c9feaf792
1 changed files with 6 additions and 0 deletions

View File

@ -21,6 +21,7 @@ import (
"github.com/blevesearch/bleve/index"
"github.com/blevesearch/bleve/index/store"
"github.com/blevesearch/bleve/index/store/inmem"
"github.com/blevesearch/bleve/index/upside_down"
"github.com/blevesearch/bleve/registry"
"github.com/blevesearch/bleve/search"
"github.com/blevesearch/bleve/search/collectors"
@ -183,6 +184,11 @@ func openIndexUsing(path string, runtimeConfig map[string]interface{}) (rv *inde
return nil, err
}
// backwards compatability if index type is missing
if rv.meta.IndexType == "" {
rv.meta.IndexType = upside_down.Name
}
storeConstructor := registry.KVStoreConstructorByName(rv.meta.Storage)
if storeConstructor == nil {
return nil, ErrorUnknownStorageType