Skip to content

Commit efafd86

Browse files
committed
MB-57888: Minor Code Refactoring
1 parent f131416 commit efafd86

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

index/scorch/optimize_knn.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ func (o *OptimizeVR) Finish() error {
101101
wg.Done()
102102
}()
103103
for _, field := range fields {
104+
// Noop if the vector field or its index data is supposed to be deleted
104105
if info, ok := o.snapshot.updatedFields[field]; ok && (info.Deleted || info.Index) {
105106
continue
106107
}

index_update.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ func compareMappings(ori, upd *mapping.IndexMappingImpl) error {
156156
// Ensures updated document mapping does not contain new
157157
// field mappings or document mappings
158158
func checkUpdatedMapping(ori, upd *mapping.DocumentMapping) error {
159-
160159
// Check to verify both original and updated are not nil
161160
// and are enabled before proceeding
162161
if ori == nil {
@@ -183,7 +182,6 @@ func checkUpdatedMapping(ori, upd *mapping.DocumentMapping) error {
183182
// in updated
184183
for _, updFMapping := range upd.Fields {
185184
var oriFMapping *mapping.FieldMapping
186-
187185
for _, fMapping := range ori.Fields {
188186
if updFMapping.Name == fMapping.Name {
189187
oriFMapping = fMapping
@@ -202,7 +200,6 @@ func checkUpdatedMapping(ori, upd *mapping.DocumentMapping) error {
202200
// for a single field or multiple document fields' data getting written to a single zapx field
203201
func addPathInfo(paths map[string]*pathInfo, name string, mp *mapping.DocumentMapping,
204202
im *mapping.IndexMappingImpl, parent *pathInfo, rootName string) {
205-
206203
// Early exit if mapping has been disabled
207204
// Comparisions later on will be done with a nil object
208205
if !mp.Enabled {
@@ -278,7 +275,6 @@ func compareCustomComponents(oriPaths, updPaths map[string]*pathInfo, ori, upd *
278275
// Standard analysers not in custom analysis are not compared
279276
// Analysers in custom analysis but not in use are not compared
280277
func compareAnalysers(oriPaths, updPaths map[string]*pathInfo, ori, upd *mapping.IndexMappingImpl) error {
281-
282278
oriAnalyzers := make(map[string]interface{})
283279
updAnalyzers := make(map[string]interface{})
284280
oriCustomAnalysers := ori.CustomAnalysis.Analyzers
@@ -330,7 +326,6 @@ func compareAnalysers(oriPaths, updPaths map[string]*pathInfo, ori, upd *mapping
330326
// Compares all date time parsers currently in use
331327
// Date time parsers in custom analysis but not in use are not compared
332328
func compareDateTimeParsers(oriPaths, updPaths map[string]*pathInfo, ori, upd *mapping.IndexMappingImpl) error {
333-
334329
oriDateTimeParsers := make(map[string]analysis.DateTimeParser)
335330
updDateTimeParsers := make(map[string]analysis.DateTimeParser)
336331

@@ -383,7 +378,6 @@ func compareDateTimeParsers(oriPaths, updPaths map[string]*pathInfo, ori, upd *m
383378
// Compares all synonym sources
384379
// Synonym sources currently not in use are also compared
385380
func compareSynonymSources(oriPaths, updPaths map[string]*pathInfo, ori, upd *mapping.IndexMappingImpl) error {
386-
387381
oriSynonymSources := make(map[string]analysis.SynonymSource)
388382
updSynonymSources := make(map[string]analysis.SynonymSource)
389383

@@ -422,7 +416,6 @@ func compareSynonymSources(oriPaths, updPaths map[string]*pathInfo, ori, upd *ma
422416

423417
// Compare all of the fields at a particular document path and add its field information
424418
func addFieldInfo(fInfo map[string]*index.UpdateFieldInfo, ori, upd *pathInfo) error {
425-
426419
var info *index.UpdateFieldInfo
427420
var updated bool
428421
var err error
@@ -500,7 +493,6 @@ func addFieldInfo(fInfo map[string]*index.UpdateFieldInfo, ori, upd *pathInfo) e
500493
// update is impossible
501494
// third argument is an error explaining exactly why the change is not possible
502495
func compareFieldMapping(original, updated *mapping.FieldMapping) (*index.UpdateFieldInfo, bool, error) {
503-
504496
rv := &index.UpdateFieldInfo{}
505497

506498
if updated == nil {
@@ -593,7 +585,6 @@ func compareFieldMapping(original, updated *mapping.FieldMapping) (*index.Update
593585
// In such a situation, any conflicting changes found will abort the update process
594586
func validateFieldInfo(newInfo *index.UpdateFieldInfo, updated bool, fInfo map[string]*index.UpdateFieldInfo,
595587
ori *pathInfo, oriFMapInfo *fieldMapInfo) error {
596-
597588
var name string
598589
if oriFMapInfo.parent.parentPath == "" {
599590
if oriFMapInfo.fieldMapping.Name == "" {

0 commit comments

Comments
 (0)