             throw ScoreFunctionBuilderError.missingRequiredField("scale")
         }
 
-        super.init(type: .gauss, field: builder.field!, origin: builder.origin!, scale: builder.scale!, offset: builder.offset!, decay: builder.decay!, multiValueMode: builder.multiValueMode)
+        super.init(type: .gauss, field: builder.field!, origin: builder.origin!, scale: builder.scale!, offset: builder.offset, decay: builder.decay, multiValueMode: builder.multiValueMode)
     }
 
     public required init(from decoder: Decoder) throws {

public struct RandomScoreFunction: ScoreFunction {
    public let scoreFunctionType: ScoreFunctionType = .randomScore

    public let seed: Int
    public let field: String

    public init(field: String, seed: Int) {
        self.seed = seed
        self.field = field
    }

    internal init(withBuilder builder: RandomScoreFunctionBuilder) throws {
        guard builder.seed != nil else {
            throw ScoreFunctionBuilderError.missingRequiredField("seed")
        }

        guard builder.field != nil else {
            throw ScoreFunctionBuilderError.missingRequiredField("field")
        }

        self.init(field: builder.field!, seed: builder.seed!)
    }

    public func toDic() -> [String: Any] {
        return [scoreFunctionType.rawValue: [CodingKeys.seed.rawValue: seed,
                                             CodingKeys.field.rawValue: field]]
    }
}


            throw ScoreFunctionBuilderError.missingRequiredField("scale")
        }

        super.init(type: .linear, field: builder.field!, origin: builder.origin!, scale: builder.scale!, offset: builder.offset, decay: builder.decay, multiValueMode: builder.multiValueMode)
    }

    public required init(from decoder: Decoder) throws {
