@@ -74,8 +74,7 @@ string IUrlParameter.GetString(IConnectionConfigurationValues settings)
7474 all => "_all" ,
7575 many =>
7676 {
77- var nestSettings = settings as IConnectionSettingsValues ;
78- if ( nestSettings == null )
77+ if ( ! ( settings is IConnectionSettingsValues nestSettings ) )
7978 throw new Exception ( "Tried to pass index names on querysting but it could not be resolved because no nest settings are available" ) ;
8079
8180 var infer = nestSettings . Inferrer ;
@@ -85,19 +84,29 @@ string IUrlParameter.GetString(IConnectionConfigurationValues settings)
8584 ) ;
8685 }
8786
87+ public static bool operator == ( Indices left , Indices right ) => Equals ( left , right ) ;
88+
89+ public static bool operator != ( Indices left , Indices right ) => ! Equals ( left , right ) ;
90+
8891 public override bool Equals ( object obj )
8992 {
90- var other = obj as Indices ;
91- if ( other == null ) return false ;
93+ if ( ! ( obj is Indices other ) ) return false ;
9294 return this . Match (
9395 all => other . Match ( a => true , m => false ) ,
9496 many => other . Match (
9597 a => false ,
96- m => this . GetHashCode ( ) . Equals ( other . GetHashCode ( ) )
98+ m => EqualsAllIndices ( m . Indices , many . Indices )
9799 )
98100 ) ;
99101 }
100102
103+ private static bool EqualsAllIndices ( IReadOnlyList < IndexName > thisIndices , IReadOnlyList < IndexName > otherIndices )
104+ {
105+ if ( thisIndices == null && otherIndices == null ) return true ;
106+ if ( thisIndices == null || otherIndices == null ) return false ;
107+ return thisIndices . Count == otherIndices . Count && ! thisIndices . Except ( otherIndices ) . Any ( ) ;
108+ }
109+
101110 public override int GetHashCode ( )
102111 {
103112 return this . Match (
0 commit comments