Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions index_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,9 @@ func compareFieldMapping(original, updated *mapping.FieldMapping) (*index.Update
if original.VectorIndexOptimizedFor != updated.VectorIndexOptimizedFor {
return nil, fmt.Errorf("vectorIndexOptimizedFor cannot be updated for vector and vector_base64 fields")
}
if original.UseGPU != updated.UseGPU {
return nil, fmt.Errorf("useGPU cannot be updated for vector and vector_base64 fields")
}
}
if original.IncludeInAll != updated.IncludeInAll {
return nil, fmt.Errorf("includeInAll cannot be changed")
Expand Down
11 changes: 11 additions & 0 deletions mapping/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@
VectorIndexOptimizedFor string `json:"vector_index_optimized_for,omitempty"`

SynonymSource string `json:"synonym_source,omitempty"`

// Flag that indicates whether to use GPU for field indexing and searching
UseGPU bool `json:"gpu,omitempty"`
}

// NewTextFieldMapping returns a default field mapping for text
Expand Down Expand Up @@ -226,6 +229,9 @@
if fm.SkipFreqNorm {
rv |= index.SkipFreqNorm
}
if fm.UseGPU {
rv |= index.GPU

Check failure on line 233 in mapping/field.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, macos-latest)

undefined: index.GPU

Check failure on line 233 in mapping/field.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, macos-latest)

undefined: index.GPU

Check failure on line 233 in mapping/field.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, ubuntu-latest)

undefined: index.GPU

Check failure on line 233 in mapping/field.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, ubuntu-latest)

undefined: index.GPU

Check failure on line 233 in mapping/field.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, windows-latest)

undefined: index.GPU

Check failure on line 233 in mapping/field.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, macos-latest)

undefined: index.GPU

Check failure on line 233 in mapping/field.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, ubuntu-latest)

undefined: index.GPU

Check failure on line 233 in mapping/field.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, windows-latest)

undefined: index.GPU
}
return rv
}

Expand Down Expand Up @@ -479,6 +485,11 @@
if err != nil {
return err
}
case "gpu":
err := util.UnmarshalJSON(v, &fm.UseGPU)
if err != nil {
return err
}
default:
invalidKeys = append(invalidKeys, k)
}
Expand Down
5 changes: 5 additions & 0 deletions mapping/mapping_vectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ func validateVectorFieldAlias(field *FieldMapping, parentName string,
"(different similarity values %s and %s)", fieldAlias.Name,
field.Similarity, fieldAlias.Similarity)
}
if field.UseGPU != fieldAlias.UseGPU {
return fmt.Errorf("field: '%s', invalid alias "+
"(different useGPU values %v and %v)", fieldAlias.Name,
field.UseGPU, fieldAlias.UseGPU)
}

return nil
}
Expand Down
Loading