mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-15 13:19:53 +05:00
Added nested_fields config
This commit is contained in:
@@ -25,6 +25,7 @@ type AttributeSCfg struct {
|
||||
StringIndexedFields *[]string
|
||||
PrefixIndexedFields *[]string
|
||||
ProcessRuns int
|
||||
NestedFields bool
|
||||
}
|
||||
|
||||
func (alS *AttributeSCfg) loadFromJsonCfg(jsnCfg *AttributeSJsonCfg) (err error) {
|
||||
@@ -54,5 +55,8 @@ func (alS *AttributeSCfg) loadFromJsonCfg(jsnCfg *AttributeSJsonCfg) (err error)
|
||||
if jsnCfg.Process_runs != nil {
|
||||
alS.ProcessRuns = *jsnCfg.Process_runs
|
||||
}
|
||||
if jsnCfg.Nested_fields != nil {
|
||||
alS.NestedFields = *jsnCfg.Nested_fields
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ type ChargerSCfg struct {
|
||||
AttributeSConns []string
|
||||
StringIndexedFields *[]string
|
||||
PrefixIndexedFields *[]string
|
||||
NestedFields bool
|
||||
}
|
||||
|
||||
func (cS *ChargerSCfg) loadFromJsonCfg(jsnCfg *ChargerSJsonCfg) (err error) {
|
||||
@@ -64,5 +65,8 @@ func (cS *ChargerSCfg) loadFromJsonCfg(jsnCfg *ChargerSJsonCfg) (err error) {
|
||||
}
|
||||
cS.PrefixIndexedFields = &pif
|
||||
}
|
||||
if jsnCfg.Nested_fields != nil {
|
||||
cS.NestedFields = *jsnCfg.Nested_fields
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -534,6 +534,7 @@ const CGRATES_CFG_JSON = `
|
||||
"indexed_selects":true, // enable profile matching exclusively on indexes
|
||||
//"string_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
"prefix_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
"nested_fields":false, // applies when indexed fields is not defined
|
||||
"process_runs": 1, // number of run loops when processing event
|
||||
},
|
||||
|
||||
@@ -544,6 +545,7 @@ const CGRATES_CFG_JSON = `
|
||||
"indexed_selects":true, // enable profile matching exclusively on indexes
|
||||
//"string_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
"prefix_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
"nested_fields":false, // applies when indexed fields is not defined
|
||||
},
|
||||
|
||||
|
||||
@@ -554,6 +556,7 @@ const CGRATES_CFG_JSON = `
|
||||
"indexed_selects":true, // enable profile matching exclusively on indexes
|
||||
//"string_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
"prefix_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
"nested_fields":false, // applies when indexed fields is not defined
|
||||
},
|
||||
|
||||
|
||||
@@ -565,6 +568,7 @@ const CGRATES_CFG_JSON = `
|
||||
"indexed_selects":true, // enable profile matching exclusively on indexes
|
||||
//"string_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
"prefix_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
"nested_fields":false, // applies when indexed fields is not defined
|
||||
},
|
||||
|
||||
|
||||
@@ -574,6 +578,7 @@ const CGRATES_CFG_JSON = `
|
||||
"indexed_selects":true, // enable profile matching exclusively on indexes
|
||||
//"string_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
"prefix_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
"nested_fields":false, // applies when indexed fields is not defined
|
||||
},
|
||||
|
||||
|
||||
@@ -582,6 +587,7 @@ const CGRATES_CFG_JSON = `
|
||||
"indexed_selects":true, // enable profile matching exclusively on indexes
|
||||
//"string_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
"prefix_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
"nested_fields":false, // applies when indexed fields is not defined
|
||||
"attributes_conns": [], // connections to AttributeS for altering events before supplier queries: <""|*internal|127.0.0.1:2013>
|
||||
"resources_conns": [], // connections to ResourceS for *res sorting, empty to disable functionality: <""|*internal|x.y.z.y:1234>
|
||||
"stats_conns": [], // connections to StatS for *stats sorting, empty to disable stats functionality: <""|*internal|x.y.z.y:1234>
|
||||
@@ -825,6 +831,7 @@ const CGRATES_CFG_JSON = `
|
||||
"indexed_selects":true, // enable profile matching exclusively on indexes
|
||||
//"string_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
"prefix_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
"nested_fields":false, // applies when indexed fields is not defined
|
||||
"attributes_conns": [], // connections to AttributeS for API authorization, empty to disable auth functionality: <""|*internal|x.y.z.y:1234>
|
||||
},
|
||||
|
||||
|
||||
@@ -824,11 +824,12 @@ func TestDfAttributeServJsonCfg(t *testing.T) {
|
||||
String_indexed_fields: nil,
|
||||
Prefix_indexed_fields: &[]string{},
|
||||
Process_runs: utils.IntPointer(1),
|
||||
Nested_fields: utils.BoolPointer(false),
|
||||
}
|
||||
if cfg, err := dfCgrJsonCfg.AttributeServJsonCfg(); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(eCfg, cfg) {
|
||||
t.Error("Received: ", cfg)
|
||||
t.Error("Received: ", utils.ToJSON(cfg))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -839,11 +840,12 @@ func TestDfChargerServJsonCfg(t *testing.T) {
|
||||
Attributes_conns: &[]string{},
|
||||
String_indexed_fields: nil,
|
||||
Prefix_indexed_fields: &[]string{},
|
||||
Nested_fields: utils.BoolPointer(false),
|
||||
}
|
||||
if cfg, err := dfCgrJsonCfg.ChargerServJsonCfg(); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(eCfg, cfg) {
|
||||
t.Error("Received: ", cfg)
|
||||
t.Error("Received: ", utils.ToJSON(cfg))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -868,6 +870,7 @@ func TestDfResourceLimiterSJsonCfg(t *testing.T) {
|
||||
Store_interval: utils.StringPointer(""),
|
||||
String_indexed_fields: nil,
|
||||
Prefix_indexed_fields: &[]string{},
|
||||
Nested_fields: utils.BoolPointer(false),
|
||||
}
|
||||
if cfg, err := dfCgrJsonCfg.ResourceSJsonCfg(); err != nil {
|
||||
t.Error(err)
|
||||
@@ -885,11 +888,12 @@ func TestDfStatServiceJsonCfg(t *testing.T) {
|
||||
Thresholds_conns: &[]string{},
|
||||
String_indexed_fields: nil,
|
||||
Prefix_indexed_fields: &[]string{},
|
||||
Nested_fields: utils.BoolPointer(false),
|
||||
}
|
||||
if cfg, err := dfCgrJsonCfg.StatSJsonCfg(); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(eCfg, cfg) {
|
||||
t.Error("Received: ", cfg)
|
||||
t.Error("Received: ", utils.ToJSON(cfg))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -900,6 +904,7 @@ func TestDfThresholdSJsonCfg(t *testing.T) {
|
||||
Store_interval: utils.StringPointer(""),
|
||||
String_indexed_fields: nil,
|
||||
Prefix_indexed_fields: &[]string{},
|
||||
Nested_fields: utils.BoolPointer(false),
|
||||
}
|
||||
if cfg, err := dfCgrJsonCfg.ThresholdSJsonCfg(); err != nil {
|
||||
t.Error(err)
|
||||
@@ -918,11 +923,12 @@ func TestDfSupplierSJsonCfg(t *testing.T) {
|
||||
Resources_conns: &[]string{},
|
||||
Stats_conns: &[]string{},
|
||||
Default_ratio: utils.IntPointer(1),
|
||||
Nested_fields: utils.BoolPointer(false),
|
||||
}
|
||||
if cfg, err := dfCgrJsonCfg.SupplierSJsonCfg(); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(eCfg, cfg) {
|
||||
t.Errorf("expecting: %+v, received: %+v", eCfg, cfg)
|
||||
t.Errorf("expecting: %+v, received: %+v", utils.ToJSON(eCfg), utils.ToJSON(cfg))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1530,6 +1536,7 @@ func TestDfDispatcherSJsonCfg(t *testing.T) {
|
||||
String_indexed_fields: nil,
|
||||
Prefix_indexed_fields: &[]string{},
|
||||
Attributes_conns: &[]string{},
|
||||
Nested_fields: utils.BoolPointer(false),
|
||||
}
|
||||
if cfg, err := dfCgrJsonCfg.DispatcherSJsonCfg(); err != nil {
|
||||
t.Error(err)
|
||||
|
||||
@@ -27,6 +27,7 @@ type DispatcherSCfg struct {
|
||||
StringIndexedFields *[]string
|
||||
PrefixIndexedFields *[]string
|
||||
AttributeSConns []string
|
||||
NestedFields bool
|
||||
}
|
||||
|
||||
func (dps *DispatcherSCfg) loadFromJsonCfg(jsnCfg *DispatcherSJsonCfg) (err error) {
|
||||
@@ -64,5 +65,8 @@ func (dps *DispatcherSCfg) loadFromJsonCfg(jsnCfg *DispatcherSJsonCfg) (err erro
|
||||
}
|
||||
}
|
||||
}
|
||||
if jsnCfg.Nested_fields != nil {
|
||||
dps.NestedFields = *jsnCfg.Nested_fields
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -385,6 +385,7 @@ type AttributeSJsonCfg struct {
|
||||
Indexed_selects *bool
|
||||
String_indexed_fields *[]string
|
||||
Prefix_indexed_fields *[]string
|
||||
Nested_fields *bool // applies when indexed fields is not defined
|
||||
Process_runs *int
|
||||
}
|
||||
|
||||
@@ -395,6 +396,7 @@ type ChargerSJsonCfg struct {
|
||||
Attributes_conns *[]string
|
||||
String_indexed_fields *[]string
|
||||
Prefix_indexed_fields *[]string
|
||||
Nested_fields *bool // applies when indexed fields is not defined
|
||||
}
|
||||
|
||||
// ResourceLimiter service config section
|
||||
@@ -405,6 +407,7 @@ type ResourceSJsonCfg struct {
|
||||
Store_interval *string
|
||||
String_indexed_fields *[]string
|
||||
Prefix_indexed_fields *[]string
|
||||
Nested_fields *bool // applies when indexed fields is not defined
|
||||
}
|
||||
|
||||
// Stat service config section
|
||||
@@ -416,6 +419,7 @@ type StatServJsonCfg struct {
|
||||
Thresholds_conns *[]string
|
||||
String_indexed_fields *[]string
|
||||
Prefix_indexed_fields *[]string
|
||||
Nested_fields *bool // applies when indexed fields is not defined
|
||||
}
|
||||
|
||||
// Threshold service config section
|
||||
@@ -425,6 +429,7 @@ type ThresholdSJsonCfg struct {
|
||||
Store_interval *string
|
||||
String_indexed_fields *[]string
|
||||
Prefix_indexed_fields *[]string
|
||||
Nested_fields *bool // applies when indexed fields is not defined
|
||||
}
|
||||
|
||||
// Supplier service config section
|
||||
@@ -433,6 +438,7 @@ type SupplierSJsonCfg struct {
|
||||
Indexed_selects *bool
|
||||
String_indexed_fields *[]string
|
||||
Prefix_indexed_fields *[]string
|
||||
Nested_fields *bool // applies when indexed fields is not defined
|
||||
Attributes_conns *[]string
|
||||
Resources_conns *[]string
|
||||
Stats_conns *[]string
|
||||
@@ -502,6 +508,7 @@ type DispatcherSJsonCfg struct {
|
||||
Indexed_selects *bool
|
||||
String_indexed_fields *[]string
|
||||
Prefix_indexed_fields *[]string
|
||||
Nested_fields *bool // applies when indexed fields is not defined
|
||||
Attributes_conns *[]string
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ type ResourceSConfig struct {
|
||||
StoreInterval time.Duration // Dump regularly from cache into dataDB
|
||||
StringIndexedFields *[]string
|
||||
PrefixIndexedFields *[]string
|
||||
NestedFields bool
|
||||
}
|
||||
|
||||
func (rlcfg *ResourceSConfig) loadFromJsonCfg(jsnCfg *ResourceSJsonCfg) (err error) {
|
||||
@@ -73,5 +74,8 @@ func (rlcfg *ResourceSConfig) loadFromJsonCfg(jsnCfg *ResourceSJsonCfg) (err err
|
||||
}
|
||||
rlcfg.PrefixIndexedFields = &pif
|
||||
}
|
||||
if jsnCfg.Nested_fields != nil {
|
||||
rlcfg.NestedFields = *jsnCfg.Nested_fields
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ type StatSCfg struct {
|
||||
ThresholdSConns []string
|
||||
StringIndexedFields *[]string
|
||||
PrefixIndexedFields *[]string
|
||||
NestedFields bool
|
||||
}
|
||||
|
||||
func (st *StatSCfg) loadFromJsonCfg(jsnCfg *StatServJsonCfg) (err error) {
|
||||
@@ -77,5 +78,8 @@ func (st *StatSCfg) loadFromJsonCfg(jsnCfg *StatServJsonCfg) (err error) {
|
||||
}
|
||||
st.PrefixIndexedFields = &pif
|
||||
}
|
||||
if jsnCfg.Nested_fields != nil {
|
||||
st.NestedFields = *jsnCfg.Nested_fields
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ type SupplierSCfg struct {
|
||||
ResourceSConns []string
|
||||
StatSConns []string
|
||||
DefaultRatio int
|
||||
NestedFields bool
|
||||
}
|
||||
|
||||
func (spl *SupplierSCfg) loadFromJsonCfg(jsnCfg *SupplierSJsonCfg) (err error) {
|
||||
@@ -92,5 +93,8 @@ func (spl *SupplierSCfg) loadFromJsonCfg(jsnCfg *SupplierSJsonCfg) (err error) {
|
||||
if jsnCfg.Default_ratio != nil {
|
||||
spl.DefaultRatio = *jsnCfg.Default_ratio
|
||||
}
|
||||
if jsnCfg.Nested_fields != nil {
|
||||
spl.NestedFields = *jsnCfg.Nested_fields
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ type ThresholdSCfg struct {
|
||||
StoreInterval time.Duration // Dump regularly from cache into dataDB
|
||||
StringIndexedFields *[]string
|
||||
PrefixIndexedFields *[]string
|
||||
NestedFields bool
|
||||
}
|
||||
|
||||
func (t *ThresholdSCfg) loadFromJsonCfg(jsnCfg *ThresholdSJsonCfg) (err error) {
|
||||
@@ -61,5 +62,8 @@ func (t *ThresholdSCfg) loadFromJsonCfg(jsnCfg *ThresholdSJsonCfg) (err error) {
|
||||
}
|
||||
t.PrefixIndexedFields = &pif
|
||||
}
|
||||
if jsnCfg.Nested_fields != nil {
|
||||
t.NestedFields = *jsnCfg.Nested_fields
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -29,10 +29,15 @@
|
||||
// "digest_separator": ",", // separator to use in replies containing data digests
|
||||
// "digest_equal": ":", // equal symbol used in case of digests
|
||||
// "rsr_separator": ";", // separator used within RSR fields
|
||||
// "max_parralel_conns": 100, // the maximum number of connection used by the *parallel strategy
|
||||
// },
|
||||
|
||||
|
||||
// "rpc_conns": {}, // rpc connections definitions
|
||||
// "rpc_conns": {
|
||||
// "*localhost": {
|
||||
// "conns": [{"address": "127.0.0.1:2012", "transport":"*json"}],
|
||||
// },
|
||||
// }, // rpc connections definitions
|
||||
|
||||
|
||||
// "data_db": { // database used to store runtime data (eg: accounts)
|
||||
@@ -508,6 +513,7 @@
|
||||
// "indexed_selects":true, // enable profile matching exclusively on indexes
|
||||
// //"string_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
// "prefix_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
// "nested_fields":false, // applies when indexed fields is not defined
|
||||
// "process_runs": 1, // number of run loops when processing event
|
||||
// },
|
||||
|
||||
@@ -518,6 +524,7 @@
|
||||
// "indexed_selects":true, // enable profile matching exclusively on indexes
|
||||
// //"string_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
// "prefix_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
// "nested_fields":false, // applies when indexed fields is not defined
|
||||
// },
|
||||
|
||||
|
||||
@@ -528,6 +535,7 @@
|
||||
// "indexed_selects":true, // enable profile matching exclusively on indexes
|
||||
// //"string_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
// "prefix_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
// "nested_fields":false, // applies when indexed fields is not defined
|
||||
// },
|
||||
|
||||
|
||||
@@ -539,6 +547,7 @@
|
||||
// "indexed_selects":true, // enable profile matching exclusively on indexes
|
||||
// //"string_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
// "prefix_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
// "nested_fields":false, // applies when indexed fields is not defined
|
||||
// },
|
||||
|
||||
|
||||
@@ -548,6 +557,7 @@
|
||||
// "indexed_selects":true, // enable profile matching exclusively on indexes
|
||||
// //"string_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
// "prefix_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
// "nested_fields":false, // applies when indexed fields is not defined
|
||||
// },
|
||||
|
||||
|
||||
@@ -556,6 +566,7 @@
|
||||
// "indexed_selects":true, // enable profile matching exclusively on indexes
|
||||
// //"string_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
// "prefix_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
// "nested_fields":false, // applies when indexed fields is not defined
|
||||
// "attributes_conns": [], // connections to AttributeS for altering events before supplier queries: <""|*internal|127.0.0.1:2013>
|
||||
// "resources_conns": [], // connections to ResourceS for *res sorting, empty to disable functionality: <""|*internal|x.y.z.y:1234>
|
||||
// "stats_conns": [], // connections to StatS for *stats sorting, empty to disable stats functionality: <""|*internal|x.y.z.y:1234>
|
||||
@@ -799,6 +810,7 @@
|
||||
// "indexed_selects":true, // enable profile matching exclusively on indexes
|
||||
// //"string_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
// "prefix_indexed_fields": [], // query indexes based on these fields for faster processing
|
||||
// "nested_fields":false, // applies when indexed fields is not defined
|
||||
// "attributes_conns": [], // connections to AttributeS for API authorization, empty to disable auth functionality: <""|*internal|x.y.z.y:1234>
|
||||
// },
|
||||
|
||||
|
||||
@@ -118,8 +118,10 @@ func (dS *DispatcherService) dispatcherProfileForEvent(ev *utils.CGREvent,
|
||||
prflIDs, err := engine.MatchingItemIDsForEvent(ev.Event,
|
||||
dS.cfg.DispatcherSCfg().StringIndexedFields,
|
||||
dS.cfg.DispatcherSCfg().PrefixIndexedFields,
|
||||
dS.dm, utils.CacheDispatcherFilterIndexes,
|
||||
idxKeyPrfx, dS.cfg.DispatcherSCfg().IndexedSelects)
|
||||
dS.dm, utils.CacheDispatcherFilterIndexes, idxKeyPrfx,
|
||||
dS.cfg.DispatcherSCfg().IndexedSelects,
|
||||
dS.cfg.DispatcherSCfg().NestedFields,
|
||||
)
|
||||
if err != nil {
|
||||
// return nil, err
|
||||
if err != utils.ErrNotFound {
|
||||
@@ -128,8 +130,10 @@ func (dS *DispatcherService) dispatcherProfileForEvent(ev *utils.CGREvent,
|
||||
prflIDs, err = engine.MatchingItemIDsForEvent(ev.Event,
|
||||
dS.cfg.DispatcherSCfg().StringIndexedFields,
|
||||
dS.cfg.DispatcherSCfg().PrefixIndexedFields,
|
||||
dS.dm, utils.CacheDispatcherFilterIndexes,
|
||||
anyIdxPrfx, dS.cfg.DispatcherSCfg().IndexedSelects)
|
||||
dS.dm, utils.CacheDispatcherFilterIndexes, anyIdxPrfx,
|
||||
dS.cfg.DispatcherSCfg().IndexedSelects,
|
||||
dS.cfg.DispatcherSCfg().NestedFields,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -68,16 +68,24 @@ func (alS *AttributeService) attributeProfileForEvent(args *AttrArgsProcessEvent
|
||||
if len(args.AttributeIDs) != 0 {
|
||||
attrIDs = args.AttributeIDs
|
||||
} else {
|
||||
aPrflIDs, err := MatchingItemIDsForEvent(args.Event, alS.cgrcfg.AttributeSCfg().StringIndexedFields, alS.cgrcfg.AttributeSCfg().PrefixIndexedFields,
|
||||
alS.dm, utils.CacheAttributeFilterIndexes, attrIdxKey, alS.filterS.cfg.AttributeSCfg().IndexedSelects)
|
||||
aPrflIDs, err := MatchingItemIDsForEvent(args.Event,
|
||||
alS.cgrcfg.AttributeSCfg().StringIndexedFields,
|
||||
alS.cgrcfg.AttributeSCfg().PrefixIndexedFields,
|
||||
alS.dm, utils.CacheAttributeFilterIndexes, attrIdxKey,
|
||||
alS.cgrcfg.AttributeSCfg().IndexedSelects,
|
||||
alS.cgrcfg.AttributeSCfg().NestedFields,
|
||||
)
|
||||
if err != nil {
|
||||
if err != utils.ErrNotFound {
|
||||
return nil, err
|
||||
}
|
||||
if aPrflIDs, err = MatchingItemIDsForEvent(args.Event, alS.cgrcfg.AttributeSCfg().StringIndexedFields,
|
||||
if aPrflIDs, err = MatchingItemIDsForEvent(args.Event,
|
||||
alS.cgrcfg.AttributeSCfg().StringIndexedFields,
|
||||
alS.cgrcfg.AttributeSCfg().PrefixIndexedFields,
|
||||
alS.dm, utils.CacheAttributeFilterIndexes, utils.ConcatenatedKey(args.Tenant, utils.META_ANY),
|
||||
alS.filterS.cfg.AttributeSCfg().IndexedSelects); err != nil {
|
||||
alS.dm, utils.CacheAttributeFilterIndexes,
|
||||
utils.ConcatenatedKey(args.Tenant, utils.META_ANY),
|
||||
alS.cgrcfg.AttributeSCfg().IndexedSelects,
|
||||
alS.cgrcfg.AttributeSCfg().NestedFields); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,8 +58,12 @@ func (cS *ChargerService) Shutdown() (err error) {
|
||||
// matchingChargingProfilesForEvent returns ordered list of matching chargers which are active by the time of the function call
|
||||
func (cS *ChargerService) matchingChargerProfilesForEvent(cgrEv *utils.CGREventWithArgDispatcher) (cPs ChargerProfiles, err error) {
|
||||
cpIDs, err := MatchingItemIDsForEvent(cgrEv.Event,
|
||||
cS.cfg.ChargerSCfg().StringIndexedFields, cS.cfg.ChargerSCfg().PrefixIndexedFields,
|
||||
cS.dm, utils.CacheChargerFilterIndexes, cgrEv.Tenant, cS.cfg.ChargerSCfg().IndexedSelects)
|
||||
cS.cfg.ChargerSCfg().StringIndexedFields,
|
||||
cS.cfg.ChargerSCfg().PrefixIndexedFields,
|
||||
cS.dm, utils.CacheChargerFilterIndexes, cgrEv.Tenant,
|
||||
cS.cfg.ChargerSCfg().IndexedSelects,
|
||||
cS.cfg.ChargerSCfg().NestedFields,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import (
|
||||
// fieldIDs limits the fields which are checked against indexes
|
||||
// helper on top of dataDB.MatchFilterIndex, adding utils.ANY to list of fields queried
|
||||
func MatchingItemIDsForEvent(ev map[string]interface{}, stringFldIDs, prefixFldIDs *[]string,
|
||||
dm *DataManager, cacheID, itemIDPrefix string, indexedSelects bool) (itemIDs utils.StringMap, err error) {
|
||||
dm *DataManager, cacheID, itemIDPrefix string, indexedSelects, nestedFields bool) (itemIDs utils.StringMap, err error) {
|
||||
itemIDs = make(utils.StringMap)
|
||||
|
||||
// Guard will protect the function with automatic locking
|
||||
|
||||
@@ -82,7 +82,7 @@ func TestFilterMatchingItemIDsForEvent(t *testing.T) {
|
||||
"Field": "profile",
|
||||
}
|
||||
aPrflIDs, err := MatchingItemIDsForEvent(matchEV, nil, nil,
|
||||
dmMatch, utils.CacheAttributeFilterIndexes, prefix, true)
|
||||
dmMatch, utils.CacheAttributeFilterIndexes, prefix, true, false)
|
||||
if err != nil {
|
||||
t.Errorf("Error: %+v", err)
|
||||
}
|
||||
@@ -94,7 +94,7 @@ func TestFilterMatchingItemIDsForEvent(t *testing.T) {
|
||||
"Field": "profilePrefix",
|
||||
}
|
||||
aPrflIDs, err = MatchingItemIDsForEvent(matchEV, nil, nil,
|
||||
dmMatch, utils.CacheAttributeFilterIndexes, prefix, true)
|
||||
dmMatch, utils.CacheAttributeFilterIndexes, prefix, true, false)
|
||||
if err != nil {
|
||||
t.Errorf("Error: %+v", err)
|
||||
}
|
||||
|
||||
@@ -457,8 +457,13 @@ func (rS *ResourceService) matchingResourcesForEvent(ev *utils.CGREvent,
|
||||
}
|
||||
rIDs = x.(utils.StringMap)
|
||||
} else { // select the resourceIDs out of dataDB
|
||||
rIDs, err = MatchingItemIDsForEvent(ev.Event, rS.cgrcfg.ResourceSCfg().StringIndexedFields, rS.cgrcfg.ResourceSCfg().PrefixIndexedFields,
|
||||
rS.dm, utils.CacheResourceFilterIndexes, ev.Tenant, rS.filterS.cfg.ResourceSCfg().IndexedSelects)
|
||||
rIDs, err = MatchingItemIDsForEvent(ev.Event,
|
||||
rS.cgrcfg.ResourceSCfg().StringIndexedFields,
|
||||
rS.cgrcfg.ResourceSCfg().PrefixIndexedFields,
|
||||
rS.dm, utils.CacheResourceFilterIndexes, ev.Tenant,
|
||||
rS.cgrcfg.ResourceSCfg().IndexedSelects,
|
||||
rS.cgrcfg.ResourceSCfg().NestedFields,
|
||||
)
|
||||
}
|
||||
if err != nil {
|
||||
if err == utils.ErrNotFound {
|
||||
|
||||
@@ -647,7 +647,7 @@ func TestResourceUsageTTLCase4(t *testing.T) {
|
||||
|
||||
func TestResourceMatchWithIndexFalse(t *testing.T) {
|
||||
Cache.Clear(nil)
|
||||
resService.filterS.cfg.ResourceSCfg().IndexedSelects = false
|
||||
resService.cgrcfg.ResourceSCfg().IndexedSelects = false
|
||||
mres, err := resService.matchingResourcesForEvent(resEvs[0],
|
||||
"TestResourceMatchWithIndexFalse1", &timeDurationExample)
|
||||
if err != nil {
|
||||
|
||||
@@ -156,8 +156,13 @@ func (sS *StatService) matchingStatQueuesForEvent(args *StatsArgsProcessEvent) (
|
||||
if len(args.StatIDs) != 0 {
|
||||
sqIDs = args.StatIDs
|
||||
} else {
|
||||
mapIDs, err := MatchingItemIDsForEvent(args.Event, sS.cgrcfg.StatSCfg().StringIndexedFields, sS.cgrcfg.StatSCfg().PrefixIndexedFields,
|
||||
sS.dm, utils.CacheStatFilterIndexes, args.Tenant, sS.filterS.cfg.StatSCfg().IndexedSelects)
|
||||
mapIDs, err := MatchingItemIDsForEvent(args.Event,
|
||||
sS.cgrcfg.StatSCfg().StringIndexedFields,
|
||||
sS.cgrcfg.StatSCfg().PrefixIndexedFields,
|
||||
sS.dm, utils.CacheStatFilterIndexes, args.Tenant,
|
||||
sS.cgrcfg.StatSCfg().IndexedSelects,
|
||||
sS.cgrcfg.StatSCfg().NestedFields,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ func TestStatQueuesProcessEvent(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestStatQueuesMatchWithIndexFalse(t *testing.T) {
|
||||
statService.filterS.cfg.StatSCfg().IndexedSelects = false
|
||||
statService.cgrcfg.StatSCfg().IndexedSelects = false
|
||||
msq, err := statService.matchingStatQueuesForEvent(statsEvs[0])
|
||||
if err != nil {
|
||||
t.Errorf("Error: %+v", err)
|
||||
|
||||
@@ -147,8 +147,13 @@ func (spS *SupplierService) Shutdown() error {
|
||||
|
||||
// matchingSupplierProfilesForEvent returns ordered list of matching resources which are active by the time of the call
|
||||
func (spS *SupplierService) matchingSupplierProfilesForEvent(ev *utils.CGREvent, singleResult bool) (matchingSLP []*SupplierProfile, err error) {
|
||||
sPrflIDs, err := MatchingItemIDsForEvent(ev.Event, spS.cgrcfg.SupplierSCfg().StringIndexedFields, spS.cgrcfg.SupplierSCfg().PrefixIndexedFields,
|
||||
spS.dm, utils.CacheSupplierFilterIndexes, ev.Tenant, spS.filterS.cfg.SupplierSCfg().IndexedSelects)
|
||||
sPrflIDs, err := MatchingItemIDsForEvent(ev.Event,
|
||||
spS.cgrcfg.SupplierSCfg().StringIndexedFields,
|
||||
spS.cgrcfg.SupplierSCfg().PrefixIndexedFields,
|
||||
spS.dm, utils.CacheSupplierFilterIndexes, ev.Tenant,
|
||||
spS.cgrcfg.SupplierSCfg().IndexedSelects,
|
||||
spS.cgrcfg.SupplierSCfg().NestedFields,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -630,7 +630,7 @@ func TestSuppliersAsOptsGetSuppliersMaxCost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSuppliersMatchWithIndexFalse(t *testing.T) {
|
||||
splService.filterS.cfg.SupplierSCfg().IndexedSelects = false
|
||||
splService.cgrcfg.SupplierSCfg().IndexedSelects = false
|
||||
sprf, err := splService.matchingSupplierProfilesForEvent(argsGetSuppliers[0].CGREvent, true)
|
||||
if err != nil {
|
||||
t.Errorf("Error: %+v", err)
|
||||
|
||||
@@ -228,9 +228,13 @@ func (tS *ThresholdService) matchingThresholdsForEvent(args *ArgsProcessEvent) (
|
||||
if len(args.ThresholdIDs) != 0 {
|
||||
tIDs = args.ThresholdIDs
|
||||
} else {
|
||||
tIDsMap, err := MatchingItemIDsForEvent(args.Event, tS.cgrcfg.ThresholdSCfg().StringIndexedFields,
|
||||
tS.cgrcfg.ThresholdSCfg().PrefixIndexedFields, tS.dm, utils.CacheThresholdFilterIndexes,
|
||||
args.Tenant, tS.filterS.cfg.ThresholdSCfg().IndexedSelects)
|
||||
tIDsMap, err := MatchingItemIDsForEvent(args.Event,
|
||||
tS.cgrcfg.ThresholdSCfg().StringIndexedFields,
|
||||
tS.cgrcfg.ThresholdSCfg().PrefixIndexedFields,
|
||||
tS.dm, utils.CacheThresholdFilterIndexes, args.Tenant,
|
||||
tS.cgrcfg.ThresholdSCfg().IndexedSelects,
|
||||
tS.cgrcfg.ThresholdSCfg().NestedFields,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user