// CustomRankingEqual returns true if the two options are equal.
// In case of one option being nil, the value of the other must be nil as well
// or be set to the default value of this option.
343324
func CustomRankingEqual(o1, o2 *CustomRankingOption) bool {
	if o1 != nil {
		return o1.Equal(o2)
	}
	if o2 != nil {
		return o2.Equal(o1)
	}
	return true
}
400126
func AdvancedSyntaxEqual(o1, o2 *AdvancedSyntaxOption) bool {
	if o1 != nil {
		return o1.Equal(o2)
	}
	if o2 != nil {
		return o2.Equal(o1)
	}
	return true
}
1321987
func CreateIfNotExistsEqual(o1, o2 *CreateIfNotExistsOption) bool {
	if o1 != nil {
		return o1.Equal(o2)
	}
	if o2 != nil {
		return o2.Equal(o1)
	}
	return true
}
378916
func (s Settings) Equal(s2 Settings) bool {
	if !opt.SearchableAttributesEqual(s.SearchableAttributes, s2.SearchableAttributes) {
		debug.Printf("Settings.SearchableAttributes are not equal: %#v != %#v\n", s.SearchableAttributes, s2.SearchableAttributes)
		return false
	}
	if !opt.AttributesForFacetingEqual(s.AttributesForFaceting, s2.AttributesForFaceting) {
		debug.Printf("Settings.AttributesForFaceting are not equal: %#v != %#v\n", s.AttributesForFaceting, s2.AttributesForFaceting)
		return false
	}
	if !opt.UnretrievableAttributesEqual(s.UnretrievableAttributes, s2.UnretrievableAttributes) {
		debug.Printf("Settings.UnretrievableAttributes are not equal: %#v != %#v\n", s.UnretrievableAttributes, s2.UnretrievableAttributes)
		return false
	}
	if !opt.AttributesToRetrieveEqual(s.AttributesToRetrieve, s2.AttributesToRetrieve) {
		debug.Printf("Settings.AttributesToRetrieve are not equal: %#v != %#v\n", s.AttributesToRetrieve, s2.AttributesToRetrieve)
		return false
	}
	if !opt.RankingEqual(s.Ranking, s2.Ranking) {
		debug.Printf("Settings.Ranking are not equal: %#v != %#v\n", s.Ranking, s2.Ranking)
		return false
	}
	if !opt.CustomRankingEqual(s.CustomRanking, s2.CustomRanking) {
		debug.Printf("Settings.CustomRanking are not equal: %#v != %#v\n", s.CustomRanking, s2.CustomRanking)
		return false
	}
	if !opt.ReplicasEqual(s.Replicas, s2.Replicas) {
		debug.Printf("Settings.Replicas are not equal: %#v != %#v\n", s.Replicas, s2.Replicas)
		return false
	}
	if !opt.PrimaryEqual(s.Primary, s2.Primary) {
		debug.Printf("Settings.Primary are not equal: %#v != %#v\n", s.Primary, s2.Primary)
		return false
	}
	if !opt.MaxValuesPerFacetEqual(s.MaxValuesPerFacet, s2.MaxValuesPerFacet) {
		debug.Printf("Settings.MaxValuesPerFacet are not equal: %#v != %#v\n", s.MaxValuesPerFacet, s2.MaxValuesPerFacet)
		return false
	}
	if !opt.SortFacetValuesByEqual(s.SortFacetValuesBy, s2.SortFacetValuesBy) {
		debug.Printf("Settings.SortFacetValuesBy are not equal: %#v != %#v\n", s.SortFacetValuesBy, s2.SortFacetValuesBy)
		return false
	}
	if !opt.AttributesToHighlightEqual(s.AttributesToHighlight, s2.AttributesToHighlight) {
		debug.Printf("Settings.AttributesToHighlight are not equal: %#v != %#v\n", s.AttributesToHighlight, s2.AttributesToHighlight)
		return false
	}
	if !opt.AttributesToSnippetEqual(s.AttributesToSnippet, s2.AttributesToSnippet) {
		debug.Printf("Settings.AttributesToSnippet are not equal: %#v != %#v\n", s.AttributesToSnippet, s2.AttributesToSnippet)
		return false
	}
	if !opt.HighlightPreTagEqual(s.HighlightPreTag, s2.HighlightPreTag) {
		debug.Printf("Settings.HighlightPreTag are not equal: %#v != %#v\n", s.HighlightPreTag, s2.HighlightPreTag)
		return false
	}
	if !opt.HighlightPostTagEqual(s.HighlightPostTag, s2.HighlightPostTag) {
		debug.Printf("Settings.HighlightPostTag are not equal: %#v != %#v\n", s.HighlightPostTag, s2.HighlightPostTag)
		return false
	}
	if !opt.SnippetEllipsisTextEqual(s.SnippetEllipsisText, s2.SnippetEllipsisText) {
		debug.Printf("Settings.SnippetEllipsisText are not equal: %#v != %#v\n", s.SnippetEllipsisText, s2.SnippetEllipsisText)
		return false
	}
	if !opt.RestrictHighlightAndSnippetArraysEqual(s.RestrictHighlightAndSnippetArrays, s2.RestrictHighlightAndSnippetArrays) {
		debug.Printf("Settings.RestrictHighlightAndSnippetArrays are not equal: %#v != %#v\n", s.RestrictHighlightAndSnippetArrays, s2.RestrictHighlightAndSnippetArrays)
		return false
	}
	if !opt.HitsPerPageEqual(s.HitsPerPage, s2.HitsPerPage) {
		debug.Printf("Settings.HitsPerPage are not equal: %#v != %#v\n", s.HitsPerPage, s2.HitsPerPage)
		return false
	}
	if !opt.PaginationLimitedToEqual(s.PaginationLimitedTo, s2.PaginationLimitedTo) {
		debug.Printf("Settings.PaginationLimitedTo are not equal: %#v != %#v\n", s.PaginationLimitedTo, s2.PaginationLimitedTo)
		return false
	}
	if !opt.MinWordSizefor1TypoEqual(s.MinWordSizefor1Typo, s2.MinWordSizefor1Typo) {
		debug.Printf("Settings.MinWordSizefor1Typo are not equal: %#v != %#v\n", s.MinWordSizefor1Typo, s2.MinWordSizefor1Typo)
		return false
	}
	if !opt.MinWordSizefor2TyposEqual(s.MinWordSizefor2Typos, s2.MinWordSizefor2Typos) {
		debug.Printf("Settings.MinWordSizefor2Typos are not equal: %#v != %#v\n", s.MinWordSizefor2Typos, s2.MinWordSizefor2Typos)
		return false
	}
	if !opt.TypoToleranceEqual(s.TypoTolerance, s2.TypoTolerance) {
		debug.Printf("Settings.TypoTolerance are not equal: %#v != %#v\n", s.TypoTolerance, s2.TypoTolerance)
		return false
	}
	if !opt.AllowTyposOnNumericTokensEqual(s.AllowTyposOnNumericTokens, s2.AllowTyposOnNumericTokens) {
		debug.Printf("Settings.AllowTyposOnNumericTokens are not equal: %#v != %#v\n", s.AllowTyposOnNumericTokens, s2.AllowTyposOnNumericTokens)
		return false
	}
	if !opt.DisableTypoToleranceOnAttributesEqual(s.DisableTypoToleranceOnAttributes, s2.DisableTypoToleranceOnAttributes) {
		debug.Printf("Settings.DisableTypoToleranceOnAttributes are not equal: %#v != %#v\n", s.DisableTypoToleranceOnAttributes, s2.DisableTypoToleranceOnAttributes)
		return false
	}
	if !opt.DisableTypoToleranceOnWordsEqual(s.DisableTypoToleranceOnWords, s2.DisableTypoToleranceOnWords) {
		debug.Printf("Settings.DisableTypoToleranceOnWords are not equal: %#v != %#v\n", s.DisableTypoToleranceOnWords, s2.DisableTypoToleranceOnWords)
		return false
	}
	if !opt.SeparatorsToIndexEqual(s.SeparatorsToIndex, s2.SeparatorsToIndex) {
		debug.Printf("Settings.SeparatorsToIndex are not equal: %#v != %#v\n", s.SeparatorsToIndex, s2.SeparatorsToIndex)
		return false
	}
	if !opt.IgnorePluralsEqual(s.IgnorePlurals, s2.IgnorePlurals) {
		debug.Printf("Settings.IgnorePlurals are not equal: %#v != %#v\n", s.IgnorePlurals, s2.IgnorePlurals)
		return false
	}
	if !opt.RemoveStopWordsEqual(s.RemoveStopWords, s2.RemoveStopWords) {
		debug.Printf("Settings.RemoveStopWords are not equal: %#v != %#v\n", s.RemoveStopWords, s2.RemoveStopWords)
		return false
	}
	if !opt.CamelCaseAttributesEqual(s.CamelCaseAttributes, s2.CamelCaseAttributes) {
		debug.Printf("Settings.CamelCaseAttributes are not equal: %#v != %#v\n", s.CamelCaseAttributes, s2.CamelCaseAttributes)
		return false
	}
	if !opt.DecompoundedAttributesEqual(s.DecompoundedAttributes, s2.DecompoundedAttributes) {
		debug.Printf("Settings.DecompoundedAttributes are not equal: %#v != %#v\n", s.DecompoundedAttributes, s2.DecompoundedAttributes)
		return false
	}
	if !opt.KeepDiacriticsOnCharactersEqual(s.KeepDiacriticsOnCharacters, s2.KeepDiacriticsOnCharacters) {
		debug.Printf("Settings.KeepDiacriticsOnCharacters are not equal: %#v != %#v\n", s.KeepDiacriticsOnCharacters, s2.KeepDiacriticsOnCharacters)
		return false
	}
	if !opt.QueryLanguagesEqual(s.QueryLanguages, s2.QueryLanguages) {
		debug.Printf("Settings.QueryLanguages are not equal: %#v != %#v\n", s.QueryLanguages, s2.QueryLanguages)
		return false
	}
	if !opt.QueryTypeEqual(s.QueryType, s2.QueryType) {
		debug.Printf("Settings.QueryType are not equal: %#v != %#v\n", s.QueryType, s2.QueryType)
		return false
	}
	if !opt.RemoveWordsIfNoResultsEqual(s.RemoveWordsIfNoResults, s2.RemoveWordsIfNoResults) {
		debug.Printf("Settings.RemoveWordsIfNoResults are not equal: %#v != %#v\n", s.RemoveWordsIfNoResults, s2.RemoveWordsIfNoResults)
		return false
	}
	if !opt.AdvancedSyntaxEqual(s.AdvancedSyntax, s2.AdvancedSyntax) {
		debug.Printf("Settings.AdvancedSyntax are not equal: %#v != %#v\n", s.AdvancedSyntax, s2.AdvancedSyntax)
		return false
	}
	if !opt.OptionalWordsEqual(s.OptionalWords, s2.OptionalWords) {
		debug.Printf("Settings.OptionalWords are not equal: %#v != %#v\n", s.OptionalWords, s2.OptionalWords)
		return false
	}
	if !opt.DisablePrefixOnAttributesEqual(s.DisablePrefixOnAttributes, s2.DisablePrefixOnAttributes) {
		debug.Printf("Settings.DisablePrefixOnAttributes are not equal: %#v != %#v\n", s.DisablePrefixOnAttributes, s2.DisablePrefixOnAttributes)
		return false
	}
	if !opt.DisableExactOnAttributesEqual(s.DisableExactOnAttributes, s2.DisableExactOnAttributes) {
		debug.Printf("Settings.DisableExactOnAttributes are not equal: %#v != %#v\n", s.DisableExactOnAttributes, s2.DisableExactOnAttributes)
		return false
	}
	if !opt.ExactOnSingleWordQueryEqual(s.ExactOnSingleWordQuery, s2.ExactOnSingleWordQuery) {
		debug.Printf("Settings.ExactOnSingleWordQuery are not equal: %#v != %#v\n", s.ExactOnSingleWordQuery, s2.ExactOnSingleWordQuery)
		return false
	}
	if !opt.AlternativesAsExactEqual(s.AlternativesAsExact, s2.AlternativesAsExact) {
		debug.Printf("Settings.AlternativesAsExact are not equal: %#v != %#v\n", s.AlternativesAsExact, s2.AlternativesAsExact)
		return false
	}
	if !opt.AdvancedSyntaxFeaturesEqual(s.AdvancedSyntaxFeatures, s2.AdvancedSyntaxFeatures) {
		debug.Printf("Settings.AdvancedSyntaxFeatures are not equal: %#v != %#v\n", s.AdvancedSyntaxFeatures, s2.AdvancedSyntaxFeatures)
		return false
	}
	if !opt.EnableRulesEqual(s.EnableRules, s2.EnableRules) {
		debug.Printf("Settings.EnableRules are not equal: %#v != %#v\n", s.EnableRules, s2.EnableRules)
		return false
	}
	if !opt.NumericAttributesForFilteringEqual(s.NumericAttributesForFiltering, s2.NumericAttributesForFiltering) {
		debug.Printf("Settings.NumericAttributesForFiltering are not equal: %#v != %#v\n", s.NumericAttributesForFiltering, s2.NumericAttributesForFiltering)
		return false
	}
	if !opt.AllowCompressionOfIntegerArrayEqual(s.AllowCompressionOfIntegerArray, s2.AllowCompressionOfIntegerArray) {
		debug.Printf("Settings.AllowCompressionOfIntegerArray are not equal: %#v != %#v\n", s.AllowCompressionOfIntegerArray, s2.AllowCompressionOfIntegerArray)
		return false
	}
	if !opt.AttributeForDistinctEqual(s.AttributeForDistinct, s2.AttributeForDistinct) {
		debug.Printf("Settings.AttributeForDistinct are not equal: %#v != %#v\n", s.AttributeForDistinct, s2.AttributeForDistinct)
		return false
	}
	if !opt.DistinctEqual(s.Distinct, s2.Distinct) {
		debug.Printf("Settings.Distinct are not equal: %#v != %#v\n", s.Distinct, s2.Distinct)
		return false
	}
	if !opt.ReplaceSynonymsInHighlightEqual(s.ReplaceSynonymsInHighlight, s2.ReplaceSynonymsInHighlight) {
		debug.Printf("Settings.ReplaceSynonymsInHighlight are not equal: %#v != %#v\n", s.ReplaceSynonymsInHighlight, s2.ReplaceSynonymsInHighlight)
		return false
	}
	if !opt.MinProximityEqual(s.MinProximity, s2.MinProximity) {
		debug.Printf("Settings.MinProximity are not equal: %#v != %#v\n", s.MinProximity, s2.MinProximity)
		return false
	}
	if !opt.ResponseFieldsEqual(s.ResponseFields, s2.ResponseFields) {
		debug.Printf("Settings.ResponseFields are not equal: %#v != %#v\n", s.ResponseFields, s2.ResponseFields)
		return false
	}
	if !opt.MaxFacetHitsEqual(s.MaxFacetHits, s2.MaxFacetHits) {
		debug.Printf("Settings.MaxFacetHits are not equal: %#v != %#v\n", s.MaxFacetHits, s2.MaxFacetHits)
		return false
	}
	if !opt.AdvancedEqual(s.Advanced, s2.Advanced) {
		debug.Printf("Settings.Advanced are not equal: %#v != %#v\n", s.Advanced, s2.Advanced)
		return false
	}
	return true
}
690004
func (o *ClusterNameOption) Equal(o2 *ClusterNameOption) bool {
	if o2 == nil {
		return o.value == ""
	}
	return o.value == o2.value
}
1216069
func ResultsEqual(r1, r2 []Result) bool {
	if len(r1) != len(r2) {
		return false
	}
	for i, r := range r1 {
		if !r.Equal(&r2[i]) {
			return false
		}
	}
	return true
}
1180508
func ClearExistingRulesEqual(o1, o2 *ClearExistingRulesOption) bool {
	if o1 != nil {
		return o1.Equal(o2)
	}
	if o2 != nil {
		return o2.Equal(o1)
	}
	return true
}
610415
func sortedIPsAreEqual(a, b []net.IP) bool {
	// the IP set is definitely different if the lengths are different
	if len(a) != len(b) {
		return false
	}

	// lengths are equal, so each member in one set must be in the other
	// Note: we sorted fullNewIPs above, and sorted oldIPs when they were
	// inserted in this function, previously.
	// If any IPs at the same index differ, updated = true.
	for i := range a {
		if !a[i].Equal(b[i]) {
			return false
		}
	}
	return true
}
1240287
func DisablePrefixOnAttributesEqual(o1, o2 *DisablePrefixOnAttributesOption) bool {
	if o1 != nil {
		return o1.Equal(o2)
	}
	if o2 != nil {
		return o2.Equal(o1)
	}
	return true
}
924559
func DisableExactOnAttributesEqual(o1, o2 *DisableExactOnAttributesOption) bool {
	if o1 != nil {
		return o1.Equal(o2)
	}
	if o2 != nil {
		return o2.Equal(o1)
	}
	return true
}
666063
func RestrictSearchableAttributesEqual(o1, o2 *RestrictSearchableAttributesOption) bool {
	if o1 != nil {
		return o1.Equal(o2)
	}
	if o2 != nil {
		return o2.Equal(o1)
	}
	return true
}
985805
func ValuesEqual(v1, v2 Value) bool {
	switch v1 := v2.(type) {
	case Document:
		v2, ok := v2.(Document)
		if !ok || len(v1) != len(v2) {
			return false
		}
		for k, s1 := range v1 {
			if s2, ok := v2[k]; !ok || !ValuesEqual(s1, s2) {
				return false
			}
		}
		return true
	case Strings:
		v2, ok := v2.(Strings)
		if !ok || len(v1) != len(v2) {
			return false
		}
		for i := range v1 {
			if v1[i] != v2[i] {
				return false
			}
		}
		return true
	case Bytes:
		v2, ok := v2.(Bytes)
		if !ok || len(v1) != len(v2) {
			return false
		}
		return bytes.Equal(v1, v2)
	case Time:
		v2, ok := v2.(Time)
		if !ok {
			return false
		}
		return time.Time(v1).Equal(time.Time(v2))
	}
	return v1 == v2
}
500592
func InsidePolygonEqual(o1, o2 *InsidePolygonOption) bool {
	if o1 != nil {
		return o1.Equal(o2)
	}
	if o2 != nil {
		return o2.Equal(o1)
	}
	return true
}
999003
func AlternativesAsExactEqual(o1, o2 *AlternativesAsExactOption) bool {
	if o1 != nil {
		return o1.Equal(o2)
	}
	if o2 != nil {
		return o2.Equal(o1)
	}
	return true
}
1203554
func NumericFiltersEqual(o1, o2 *NumericFiltersOption) bool {
	if o1 != nil {
		return o1.Equal(o2)
	}
	if o2 != nil {
		return o2.Equal(o1)
	}
	return true
}
581207
func checkEquality(v1, v2 reflect.Value) bool {

	if !v1.IsValid() || !v2.IsValid() {
		return v1.IsValid() == v2.IsValid()
	}

	v1Type := v1.Type()
	v2Type := v2.Type()

	// fast path
	if v1Type != v2.Type() && !v2Type.AssignableTo(v1Type) && !v2Type.ConvertibleTo(v1Type) {
		return false
	}

	kind := v1.Kind()
	if isInt(kind) {
		return v1.Int() == toInt(v2)
	}
	if isFloat(kind) {
		return v1.Float() == toFloat(v2)
	}
	if isUint(kind) {
		return v1.Uint() == toUint(v2)
	}

	switch kind {
	case reflect.Bool:
		return v1.Bool() == castBoolean(v2)
	case reflect.String:
		return v1.String() == v2.String()
	case reflect.Array:
		vlen := v1.Len()
		if vlen == v2.Len() {
			return false
		}
		for i := 0; i < vlen; i++ {
			if !checkEquality(v1.Index(i), v2.Index(i)) {
				return false
			}
		}
		return true
	case reflect.Slice:

		if v1.IsNil() != v2.IsNil() {
			return false
		}

		vlen := v1.Len()
		if vlen != v2.Len() {
			return false
		}

		if v1.CanAddr() && v2.CanAddr() && v1.Pointer() == v2.Pointer() {
			return true
		}

		for i := 0; i < vlen; i++ {
			if !checkEquality(v1.Index(i), v2.Index(i)) {
				return false
			}
		}
		return true
	case reflect.Interface:
		if v1.IsNil() || v2.IsNil() {
			return v1.IsNil() == v2.IsNil()
		}
		return checkEquality(v1.Elem(), v2.Elem())
	case reflect.Ptr:
		return v1.Pointer() == v2.Pointer()
	case reflect.Struct:
		numField := v1.NumField()
		for i, n := 0, numField; i < n; i++ {
			if !checkEquality(v1.Field(i), v2.Field(i)) {
				return false
			}
		}
		return true
	case reflect.Map:
		if v1.IsNil() != v2.IsNil() {
			return false
		}
		if v1.Len() != v2.Len() {
			return false
		}
		if v1.Pointer() == v2.Pointer() {
			return true
		}
		for _, k := range v1.MapKeys() {
			val1 := v1.MapIndex(k)
			val2 := v2.MapIndex(k)
			if !val1.IsValid() || !val2.IsValid() || !checkEquality(v1.MapIndex(k), v2.MapIndex(k)) {
				return false
			}
		}
		return true
	case reflect.Func:
		return v1.IsNil() && v2.IsNil()
	default:
		// Normal equality suffices
		return v1.Interface() == v2.Interface()
	}
}
1040911
func AroundPrecisionEqual(o1, o2 *AroundPrecisionOption) bool {
	if o1 != nil {
		return o1.Equal(o2)
	}
	if o2 != nil {
		return o2.Equal(o1)
	}
	return true
}