Last active
October 11, 2017 11:49
-
-
Save mchampaneri/ca8abfa9f667ba475a21fa105510bad7 to your computer and use it in GitHub Desktop.
Create the bleve index
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func LoadIndex() { | |
| index1, index1Err = bleve.Open("index1.bleve") | |
| index2, index2Err = bleve.Open("index2.bleve") | |
| index3, index3Err = bleve.Open("index3.bleve") | |
| // Check if index1 is exits or not | |
| // If not than create a new one | |
| if index1Err != nil { | |
| // create a new mapping file and create a new index | |
| mapping := bleve.NewIndexMapping() | |
| index1, index1Err = bleve.New("index1.bleve", mapping) | |
| if index1Err != nil { | |
| return | |
| } | |
| } | |
| // Check if index2 is exits or not | |
| // If not than create a new one | |
| if index2Err != nil { | |
| // create a new mapping file and create a new index | |
| mapping := bleve.NewIndexMapping() | |
| index2, index2Err = bleve.New("index2.bleve", mapping) | |
| if index2Err != nil { | |
| return | |
| } | |
| } | |
| // Check if index3 is exits or not | |
| // If not than create a new one | |
| if index3Err != nil { | |
| // create a new mapping file and create a new index | |
| mapping := bleve.NewIndexMapping() | |
| index3, index3Err = bleve.New("index3.bleve", mapping) | |
| if index3Err != nil { | |
| return | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment