Add infrastructure for *suffix filter indexes

This commit is contained in:
TeoV
2020-07-27 16:00:33 +03:00
committed by Dan Christian Bogos
parent 3ec344bdf1
commit 05e2377d3c
22 changed files with 123 additions and 6 deletions

View File

@@ -26,6 +26,7 @@ type AttributeSCfg struct {
IndexedSelects bool
StringIndexedFields *[]string
PrefixIndexedFields *[]string
SuffixIndexedFields *[]string
ProcessRuns int
NestedFields bool
}
@@ -54,6 +55,13 @@ func (alS *AttributeSCfg) loadFromJsonCfg(jsnCfg *AttributeSJsonCfg) (err error)
}
alS.PrefixIndexedFields = &pif
}
if jsnCfg.Suffix_indexed_fields != nil {
sif := make([]string, len(*jsnCfg.Suffix_indexed_fields))
for i, fID := range *jsnCfg.Suffix_indexed_fields {
sif[i] = fID
}
alS.SuffixIndexedFields = &sif
}
if jsnCfg.Process_runs != nil {
alS.ProcessRuns = *jsnCfg.Process_runs
}

View File

@@ -31,6 +31,7 @@ type ChargerSCfg struct {
AttributeSConns []string
StringIndexedFields *[]string
PrefixIndexedFields *[]string
SuffixIndexedFields *[]string
NestedFields bool
}
@@ -69,6 +70,13 @@ func (cS *ChargerSCfg) loadFromJsonCfg(jsnCfg *ChargerSJsonCfg) (err error) {
}
cS.PrefixIndexedFields = &pif
}
if jsnCfg.Suffix_indexed_fields != nil {
sif := make([]string, len(*jsnCfg.Suffix_indexed_fields))
for i, fID := range *jsnCfg.Suffix_indexed_fields {
sif[i] = fID
}
cS.SuffixIndexedFields = &sif
}
if jsnCfg.Nested_fields != nil {
cS.NestedFields = *jsnCfg.Nested_fields
}

View File

@@ -580,6 +580,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
"suffix_indexed_fields": [], // query indexes based on these fields for faster processing
"nested_fields": false, // determines which field is checked when matching indexed filters(true: all; false: only the one on the first level)
"process_runs": 1, // number of run loops when processing event
},
@@ -591,6 +592,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
"suffix_indexed_fields": [], // query indexes based on these fields for faster processing
"nested_fields": false, // determines which field is checked when matching indexed filters(true: all; false: only the one on the first level)
},
@@ -602,6 +604,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
"suffix_indexed_fields": [], // query indexes based on these fields for faster processing
"nested_fields": false, // determines which field is checked when matching indexed filters(true: all; false: only the one on the first level)
},
@@ -614,6 +617,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
"suffix_indexed_fields": [], // query indexes based on these fields for faster processing
"nested_fields": false, // determines which field is checked when matching indexed filters(true: all; false: only the one on the first level)
},
@@ -624,6 +628,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
"suffix_indexed_fields": [], // query indexes based on these fields for faster processing
"nested_fields": false, // determines which field is checked when matching indexed filters(true: all; false: only the one on the first level)
},
@@ -633,6 +638,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
"suffix_indexed_fields": [], // query indexes based on these fields for faster processing
"nested_fields": false, // determines which field is checked when matching indexed filters(true: all; false: only the one on the first level)
"attributes_conns": [], // connections to AttributeS for altering events before route queries: <""|*internal|$rpc_conns_id>
"resources_conns": [], // connections to ResourceS for *res sorting, empty to disable functionality: <""|*internal|$rpc_conns_id>
@@ -907,6 +913,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
"suffix_indexed_fields": [], // query indexes based on these fields for faster processing
"nested_fields": false, // determines which field is checked when matching indexed filters(true: all; false: only the one on the first level)
"attributes_conns": [], // connections to AttributeS for API authorization, empty to disable auth functionality: <""|*internal|$rpc_conns_id>
},
@@ -930,10 +937,12 @@ 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
"suffix_indexed_fields": [], // query indexes based on these fields for faster processing
"nested_fields": false, // determines which field is checked when matching indexed filters(true: all; false: only the one on the first level)
"rate_indexed_selects": true, // enable profile matching exclusively on indexes
//"rate_string_indexed_fields": [], // query indexes based on these fields for faster processing
"rate_prefix_indexed_fields": [], // query indexes based on these fields for faster processing
"rate_suffix_indexed_fields": [], // query indexes based on these fields for faster processing
"rate_nested_fields": false, // determines which field is checked when matching indexed filters(true: all; false: only the one on the first level)
},

View File

@@ -958,6 +958,7 @@ func TestDfAttributeServJsonCfg(t *testing.T) {
Indexed_selects: utils.BoolPointer(true),
String_indexed_fields: nil,
Prefix_indexed_fields: &[]string{},
Suffix_indexed_fields: &[]string{},
Process_runs: utils.IntPointer(1),
Nested_fields: utils.BoolPointer(false),
}
@@ -975,6 +976,7 @@ func TestDfChargerServJsonCfg(t *testing.T) {
Attributes_conns: &[]string{},
String_indexed_fields: nil,
Prefix_indexed_fields: &[]string{},
Suffix_indexed_fields: &[]string{},
Nested_fields: utils.BoolPointer(false),
}
if cfg, err := dfCgrJSONCfg.ChargerServJsonCfg(); err != nil {
@@ -1005,6 +1007,7 @@ func TestDfResourceLimiterSJsonCfg(t *testing.T) {
Store_interval: utils.StringPointer(""),
String_indexed_fields: nil,
Prefix_indexed_fields: &[]string{},
Suffix_indexed_fields: &[]string{},
Nested_fields: utils.BoolPointer(false),
}
if cfg, err := dfCgrJSONCfg.ResourceSJsonCfg(); err != nil {
@@ -1023,6 +1026,7 @@ func TestDfStatServiceJsonCfg(t *testing.T) {
Thresholds_conns: &[]string{},
String_indexed_fields: nil,
Prefix_indexed_fields: &[]string{},
Suffix_indexed_fields: &[]string{},
Nested_fields: utils.BoolPointer(false),
}
if cfg, err := dfCgrJSONCfg.StatSJsonCfg(); err != nil {
@@ -1039,6 +1043,7 @@ func TestDfThresholdSJsonCfg(t *testing.T) {
Store_interval: utils.StringPointer(""),
String_indexed_fields: nil,
Prefix_indexed_fields: &[]string{},
Suffix_indexed_fields: &[]string{},
Nested_fields: utils.BoolPointer(false),
}
if cfg, err := dfCgrJSONCfg.ThresholdSJsonCfg(); err != nil {
@@ -1054,6 +1059,7 @@ func TestDfRouteSJsonCfg(t *testing.T) {
Indexed_selects: utils.BoolPointer(true),
String_indexed_fields: nil,
Prefix_indexed_fields: &[]string{},
Suffix_indexed_fields: &[]string{},
Attributes_conns: &[]string{},
Resources_conns: &[]string{},
Stats_conns: &[]string{},
@@ -1698,6 +1704,7 @@ func TestDfDispatcherSJsonCfg(t *testing.T) {
Indexed_selects: utils.BoolPointer(true),
String_indexed_fields: nil,
Prefix_indexed_fields: &[]string{},
Suffix_indexed_fields: &[]string{},
Attributes_conns: &[]string{},
Nested_fields: utils.BoolPointer(false),
}
@@ -1980,10 +1987,12 @@ func TestDfRateSJsonCfg(t *testing.T) {
Indexed_selects: utils.BoolPointer(true),
String_indexed_fields: nil,
Prefix_indexed_fields: &[]string{},
Suffix_indexed_fields: &[]string{},
Nested_fields: utils.BoolPointer(false),
Rate_indexed_selects: utils.BoolPointer(true),
Rate_string_indexed_fields: nil,
Rate_prefix_indexed_fields: &[]string{},
Rate_suffix_indexed_fields: &[]string{},
Rate_nested_fields: utils.BoolPointer(false),
}
if cfg, err := dfCgrJSONCfg.RateCfgJson(); err != nil {

View File

@@ -727,6 +727,7 @@ func TestCgrCfgJSONDefaultSChargerSCfg(t *testing.T) {
AttributeSConns: []string{},
StringIndexedFields: nil,
PrefixIndexedFields: &[]string{},
SuffixIndexedFields: &[]string{},
}
if !reflect.DeepEqual(eChargerSCfg, cgrCfg.chargerSCfg) {
t.Errorf("received: %+v, expecting: %+v", eChargerSCfg, cgrCfg.chargerSCfg)
@@ -741,6 +742,7 @@ func TestCgrCfgJSONDefaultsResLimCfg(t *testing.T) {
StoreInterval: 0,
StringIndexedFields: nil,
PrefixIndexedFields: &[]string{},
SuffixIndexedFields: &[]string{},
}
if !reflect.DeepEqual(cgrCfg.resourceSCfg, eResLiCfg) {
t.Errorf("expecting: %s, received: %s", utils.ToJSON(eResLiCfg), utils.ToJSON(cgrCfg.resourceSCfg))
@@ -756,6 +758,7 @@ func TestCgrCfgJSONDefaultStatsCfg(t *testing.T) {
ThresholdSConns: []string{},
StringIndexedFields: nil,
PrefixIndexedFields: &[]string{},
SuffixIndexedFields: &[]string{},
}
if !reflect.DeepEqual(cgrCfg.statsCfg, eStatsCfg) {
t.Errorf("received: %+v, expecting: %+v", cgrCfg.statsCfg, eStatsCfg)
@@ -769,6 +772,7 @@ func TestCgrCfgJSONDefaultThresholdSCfg(t *testing.T) {
StoreInterval: 0,
StringIndexedFields: nil,
PrefixIndexedFields: &[]string{},
SuffixIndexedFields: &[]string{},
}
if !reflect.DeepEqual(eThresholdSCfg, cgrCfg.thresholdSCfg) {
t.Errorf("received: %+v, expecting: %+v", eThresholdSCfg, cgrCfg.thresholdSCfg)
@@ -781,6 +785,7 @@ func TestCgrCfgJSONDefaultRouteSCfg(t *testing.T) {
IndexedSelects: true,
StringIndexedFields: nil,
PrefixIndexedFields: &[]string{},
SuffixIndexedFields: &[]string{},
AttributeSConns: []string{},
ResourceSConns: []string{},
StatSConns: []string{},
@@ -1685,6 +1690,7 @@ func TestCgrCfgJSONDefaultDispatcherSCfg(t *testing.T) {
IndexedSelects: true,
StringIndexedFields: nil,
PrefixIndexedFields: &[]string{},
SuffixIndexedFields: &[]string{},
AttributeSConns: []string{},
}
if !reflect.DeepEqual(cgrCfg.dispatcherSCfg, eDspSCfg) {
@@ -1838,10 +1844,12 @@ func TestCgrCfgJSONDefaultRateCfg(t *testing.T) {
IndexedSelects: true,
StringIndexedFields: nil,
PrefixIndexedFields: &[]string{},
SuffixIndexedFields: &[]string{},
NestedFields: false,
RateIndexedSelects: true,
RateStringIndexedFields: nil,
RatePrefixIndexedFields: &[]string{},
RateSuffixIndexedFields: &[]string{},
RateNestedFields: false,
}
if !reflect.DeepEqual(cgrCfg.rateSCfg, eCfg) {

View File

@@ -30,6 +30,7 @@ type DispatcherSCfg struct {
IndexedSelects bool
StringIndexedFields *[]string
PrefixIndexedFields *[]string
SuffixIndexedFields *[]string
AttributeSConns []string
NestedFields bool
}
@@ -58,6 +59,13 @@ func (dps *DispatcherSCfg) loadFromJsonCfg(jsnCfg *DispatcherSJsonCfg) (err erro
}
dps.PrefixIndexedFields = &pif
}
if jsnCfg.Suffix_indexed_fields != nil {
sif := make([]string, len(*jsnCfg.Suffix_indexed_fields))
for i, fID := range *jsnCfg.Suffix_indexed_fields {
sif[i] = fID
}
dps.SuffixIndexedFields = &sif
}
if jsnCfg.Attributes_conns != nil {
dps.AttributeSConns = make([]string, len(*jsnCfg.Attributes_conns))
for idx, connID := range *jsnCfg.Attributes_conns {

View File

@@ -408,6 +408,7 @@ type AttributeSJsonCfg struct {
Indexed_selects *bool
String_indexed_fields *[]string
Prefix_indexed_fields *[]string
Suffix_indexed_fields *[]string
Nested_fields *bool // applies when indexed fields is not defined
Process_runs *int
}
@@ -419,6 +420,7 @@ type ChargerSJsonCfg struct {
Attributes_conns *[]string
String_indexed_fields *[]string
Prefix_indexed_fields *[]string
Suffix_indexed_fields *[]string
Nested_fields *bool // applies when indexed fields is not defined
}
@@ -430,6 +432,7 @@ type ResourceSJsonCfg struct {
Store_interval *string
String_indexed_fields *[]string
Prefix_indexed_fields *[]string
Suffix_indexed_fields *[]string
Nested_fields *bool // applies when indexed fields is not defined
}
@@ -442,6 +445,7 @@ type StatServJsonCfg struct {
Thresholds_conns *[]string
String_indexed_fields *[]string
Prefix_indexed_fields *[]string
Suffix_indexed_fields *[]string
Nested_fields *bool // applies when indexed fields is not defined
}
@@ -452,15 +456,17 @@ type ThresholdSJsonCfg struct {
Store_interval *string
String_indexed_fields *[]string
Prefix_indexed_fields *[]string
Suffix_indexed_fields *[]string
Nested_fields *bool // applies when indexed fields is not defined
}
// Rounte service config section
// Route service config section
type RouteSJsonCfg struct {
Enabled *bool
Indexed_selects *bool
String_indexed_fields *[]string
Prefix_indexed_fields *[]string
Suffix_indexed_fields *[]string
Nested_fields *bool // applies when indexed fields is not defined
Attributes_conns *[]string
Resources_conns *[]string
@@ -533,6 +539,7 @@ type DispatcherSJsonCfg struct {
Indexed_selects *bool
String_indexed_fields *[]string
Prefix_indexed_fields *[]string
Suffix_indexed_fields *[]string
Nested_fields *bool // applies when indexed fields is not defined
Attributes_conns *[]string
}
@@ -613,10 +620,12 @@ type RateSJsonCfg struct {
Indexed_selects *bool
String_indexed_fields *[]string
Prefix_indexed_fields *[]string
Suffix_indexed_fields *[]string
Nested_fields *bool // applies when indexed fields is not defined
Rate_indexed_selects *bool
Rate_string_indexed_fields *[]string
Rate_prefix_indexed_fields *[]string
Rate_suffix_indexed_fields *[]string
Rate_nested_fields *bool // applies when indexed fields is not defined
}

View File

@@ -27,10 +27,12 @@ type RateSCfg struct {
IndexedSelects bool
StringIndexedFields *[]string
PrefixIndexedFields *[]string
SuffixIndexedFields *[]string
NestedFields bool
RateIndexedSelects bool
RateStringIndexedFields *[]string
RatePrefixIndexedFields *[]string
RateSuffixIndexedFields *[]string
RateNestedFields bool
}
@@ -58,6 +60,13 @@ func (rCfg *RateSCfg) loadFromJsonCfg(jsnCfg *RateSJsonCfg) (err error) {
}
rCfg.PrefixIndexedFields = &pif
}
if jsnCfg.Suffix_indexed_fields != nil {
sif := make([]string, len(*jsnCfg.Suffix_indexed_fields))
for i, fID := range *jsnCfg.Suffix_indexed_fields {
sif[i] = fID
}
rCfg.SuffixIndexedFields = &sif
}
if jsnCfg.Nested_fields != nil {
rCfg.NestedFields = *jsnCfg.Nested_fields
}
@@ -79,6 +88,13 @@ func (rCfg *RateSCfg) loadFromJsonCfg(jsnCfg *RateSJsonCfg) (err error) {
}
rCfg.RatePrefixIndexedFields = &pif
}
if jsnCfg.Rate_suffix_indexed_fields != nil {
sif := make([]string, len(*jsnCfg.Rate_suffix_indexed_fields))
for i, fID := range *jsnCfg.Rate_suffix_indexed_fields {
sif[i] = fID
}
rCfg.RateSuffixIndexedFields = &sif
}
if jsnCfg.Rate_nested_fields != nil {
rCfg.RateNestedFields = *jsnCfg.Rate_nested_fields
}

View File

@@ -32,6 +32,7 @@ type ResourceSConfig struct {
StoreInterval time.Duration // Dump regularly from cache into dataDB
StringIndexedFields *[]string
PrefixIndexedFields *[]string
SuffixIndexedFields *[]string
NestedFields bool
}
@@ -75,6 +76,13 @@ func (rlcfg *ResourceSConfig) loadFromJsonCfg(jsnCfg *ResourceSJsonCfg) (err err
}
rlcfg.PrefixIndexedFields = &pif
}
if jsnCfg.Suffix_indexed_fields != nil {
sif := make([]string, len(*jsnCfg.Suffix_indexed_fields))
for i, fID := range *jsnCfg.Suffix_indexed_fields {
sif[i] = fID
}
rlcfg.SuffixIndexedFields = &sif
}
if jsnCfg.Nested_fields != nil {
rlcfg.NestedFields = *jsnCfg.Nested_fields
}

View File

@@ -30,6 +30,7 @@ type RouteSCfg struct {
IndexedSelects bool
StringIndexedFields *[]string
PrefixIndexedFields *[]string
SuffixIndexedFields *[]string
AttributeSConns []string
ResourceSConns []string
StatSConns []string
@@ -62,6 +63,13 @@ func (rts *RouteSCfg) loadFromJsonCfg(jsnCfg *RouteSJsonCfg) (err error) {
}
rts.PrefixIndexedFields = &pif
}
if jsnCfg.Suffix_indexed_fields != nil {
sif := make([]string, len(*jsnCfg.Suffix_indexed_fields))
for i, fID := range *jsnCfg.Suffix_indexed_fields {
sif[i] = fID
}
rts.SuffixIndexedFields = &sif
}
if jsnCfg.Attributes_conns != nil {
rts.AttributeSConns = make([]string, len(*jsnCfg.Attributes_conns))
for idx, conn := range *jsnCfg.Attributes_conns {

View File

@@ -33,6 +33,7 @@ type StatSCfg struct {
ThresholdSConns []string
StringIndexedFields *[]string
PrefixIndexedFields *[]string
SuffixIndexedFields *[]string
NestedFields bool
}
@@ -79,6 +80,13 @@ func (st *StatSCfg) loadFromJsonCfg(jsnCfg *StatServJsonCfg) (err error) {
}
st.PrefixIndexedFields = &pif
}
if jsnCfg.Suffix_indexed_fields != nil {
sif := make([]string, len(*jsnCfg.Suffix_indexed_fields))
for i, fID := range *jsnCfg.Suffix_indexed_fields {
sif[i] = fID
}
st.SuffixIndexedFields = &sif
}
if jsnCfg.Nested_fields != nil {
st.NestedFields = *jsnCfg.Nested_fields
}

View File

@@ -30,6 +30,7 @@ type ThresholdSCfg struct {
StoreInterval time.Duration // Dump regularly from cache into dataDB
StringIndexedFields *[]string
PrefixIndexedFields *[]string
SuffixIndexedFields *[]string
NestedFields bool
}
@@ -62,6 +63,13 @@ func (t *ThresholdSCfg) loadFromJsonCfg(jsnCfg *ThresholdSJsonCfg) (err error) {
}
t.PrefixIndexedFields = &pif
}
if jsnCfg.Suffix_indexed_fields != nil {
sif := make([]string, len(*jsnCfg.Suffix_indexed_fields))
for i, fID := range *jsnCfg.Suffix_indexed_fields {
sif[i] = fID
}
t.SuffixIndexedFields = &sif
}
if jsnCfg.Nested_fields != nil {
t.NestedFields = *jsnCfg.Nested_fields
}

View File

@@ -120,6 +120,7 @@ func (dS *DispatcherService) dispatcherProfileForEvent(ev *utils.CGREvent,
prflIDs, err := engine.MatchingItemIDsForEvent(evNm,
dS.cfg.DispatcherSCfg().StringIndexedFields,
dS.cfg.DispatcherSCfg().PrefixIndexedFields,
dS.cfg.DispatcherSCfg().SuffixIndexedFields,
dS.dm, utils.CacheDispatcherFilterIndexes, idxKeyPrfx,
dS.cfg.DispatcherSCfg().IndexedSelects,
dS.cfg.DispatcherSCfg().NestedFields,
@@ -132,6 +133,7 @@ func (dS *DispatcherService) dispatcherProfileForEvent(ev *utils.CGREvent,
prflIDs, err = engine.MatchingItemIDsForEvent(evNm,
dS.cfg.DispatcherSCfg().StringIndexedFields,
dS.cfg.DispatcherSCfg().PrefixIndexedFields,
dS.cfg.DispatcherSCfg().SuffixIndexedFields,
dS.dm, utils.CacheDispatcherFilterIndexes, anyIdxPrfx,
dS.cfg.DispatcherSCfg().IndexedSelects,
dS.cfg.DispatcherSCfg().NestedFields,

View File

@@ -75,6 +75,7 @@ func (alS *AttributeService) attributeProfileForEvent(args *AttrArgsProcessEvent
aPrflIDs, err := MatchingItemIDsForEvent(evNm,
alS.cgrcfg.AttributeSCfg().StringIndexedFields,
alS.cgrcfg.AttributeSCfg().PrefixIndexedFields,
alS.cgrcfg.AttributeSCfg().SuffixIndexedFields,
alS.dm, utils.CacheAttributeFilterIndexes, attrIdxKey,
alS.cgrcfg.AttributeSCfg().IndexedSelects,
alS.cgrcfg.AttributeSCfg().NestedFields,
@@ -86,6 +87,7 @@ func (alS *AttributeService) attributeProfileForEvent(args *AttrArgsProcessEvent
if aPrflIDs, err = MatchingItemIDsForEvent(evNm,
alS.cgrcfg.AttributeSCfg().StringIndexedFields,
alS.cgrcfg.AttributeSCfg().PrefixIndexedFields,
alS.cgrcfg.AttributeSCfg().SuffixIndexedFields,
alS.dm, utils.CacheAttributeFilterIndexes,
utils.ConcatenatedKey(args.Tenant, utils.META_ANY),
alS.cgrcfg.AttributeSCfg().IndexedSelects,

View File

@@ -64,6 +64,7 @@ func (cS *ChargerService) matchingChargerProfilesForEvent(cgrEv *utils.CGREventW
cpIDs, err := MatchingItemIDsForEvent(evNm,
cS.cfg.ChargerSCfg().StringIndexedFields,
cS.cfg.ChargerSCfg().PrefixIndexedFields,
cS.cfg.ChargerSCfg().SuffixIndexedFields,
cS.dm, utils.CacheChargerFilterIndexes, cgrEv.Tenant,
cS.cfg.ChargerSCfg().IndexedSelects,
cS.cfg.ChargerSCfg().NestedFields,

View File

@@ -29,7 +29,7 @@ import (
// MatchingItemIDsForEvent returns the list of item IDs matching fieldName/fieldValue for an event
// fieldIDs limits the fields which are checked against indexes
// helper on top of dataDB.GetIndexes, adding utils.ANY to list of fields queried
func MatchingItemIDsForEvent(ev utils.MapStorage, stringFldIDs, prefixFldIDs *[]string,
func MatchingItemIDsForEvent(ev utils.MapStorage, stringFldIDs, prefixFldIDs, suffixFldIDs *[]string,
dm *DataManager, cacheID, itemIDPrefix string, indexedSelects, nestedFields bool) (itemIDs utils.StringSet, err error) {
itemIDs = make(utils.StringSet)
var allFieldIDs []string

View File

@@ -478,6 +478,7 @@ func (rS *ResourceService) matchingResourcesForEvent(ev *utils.CGREvent,
rIDs, err = MatchingItemIDsForEvent(evNm,
rS.cgrcfg.ResourceSCfg().StringIndexedFields,
rS.cgrcfg.ResourceSCfg().PrefixIndexedFields,
rS.cgrcfg.ResourceSCfg().SuffixIndexedFields,
rS.dm, utils.CacheResourceFilterIndexes, ev.Tenant,
rS.cgrcfg.ResourceSCfg().IndexedSelects,
rS.cgrcfg.ResourceSCfg().NestedFields,

View File

@@ -158,6 +158,7 @@ func (rpS *RouteService) matchingRouteProfilesForEvent(ev *utils.CGREvent, singl
rPrfIDs, err := MatchingItemIDsForEvent(evNm,
rpS.cgrcfg.RouteSCfg().StringIndexedFields,
rpS.cgrcfg.RouteSCfg().PrefixIndexedFields,
rpS.cgrcfg.RouteSCfg().SuffixIndexedFields,
rpS.dm, utils.CacheRouteFilterIndexes, ev.Tenant,
rpS.cgrcfg.RouteSCfg().IndexedSelects,
rpS.cgrcfg.RouteSCfg().NestedFields,

View File

@@ -157,6 +157,7 @@ func (sS *StatService) matchingStatQueuesForEvent(args *StatsArgsProcessEvent) (
sqIDs, err = MatchingItemIDsForEvent(evNm,
sS.cgrcfg.StatSCfg().StringIndexedFields,
sS.cgrcfg.StatSCfg().PrefixIndexedFields,
sS.cgrcfg.StatSCfg().SuffixIndexedFields,
sS.dm, utils.CacheStatFilterIndexes, args.Tenant,
sS.cgrcfg.StatSCfg().IndexedSelects,
sS.cgrcfg.StatSCfg().NestedFields,

View File

@@ -241,6 +241,7 @@ func (tS *ThresholdService) matchingThresholdsForEvent(args *ArgsProcessEvent) (
tIDs, err = MatchingItemIDsForEvent(evNm,
tS.cgrcfg.ThresholdSCfg().StringIndexedFields,
tS.cgrcfg.ThresholdSCfg().PrefixIndexedFields,
tS.cgrcfg.ThresholdSCfg().SuffixIndexedFields,
tS.dm, utils.CacheThresholdFilterIndexes, args.Tenant,
tS.cgrcfg.ThresholdSCfg().IndexedSelects,
tS.cgrcfg.ThresholdSCfg().NestedFields,

View File

@@ -86,7 +86,7 @@ func TestFilterMatchingItemIDsForEvent(t *testing.T) {
utils.AnswerTime: time.Date(2014, 7, 14, 14, 30, 0, 0, time.UTC),
"Field": "profile",
}}
aPrflIDs, err := MatchingItemIDsForEvent(matchEV, nil, nil,
aPrflIDs, err := MatchingItemIDsForEvent(matchEV, nil, nil, nil,
dmMatch, utils.CacheAttributeFilterIndexes, tntCtx, true, false)
if err != nil {
t.Errorf("Error: %+v", err)
@@ -98,7 +98,7 @@ func TestFilterMatchingItemIDsForEvent(t *testing.T) {
matchEV = utils.MapStorage{utils.MetaReq: map[string]interface{}{
"Field": "profilePrefix",
}}
aPrflIDs, err = MatchingItemIDsForEvent(matchEV, nil, nil,
aPrflIDs, err = MatchingItemIDsForEvent(matchEV, nil, nil, nil,
dmMatch, utils.CacheAttributeFilterIndexes, tntCtx, true, false)
if err != nil {
t.Errorf("Error: %+v", err)
@@ -162,7 +162,7 @@ func TestFilterMatchingItemIDsForEvent2(t *testing.T) {
utils.AnswerTime: time.Date(2014, 7, 14, 14, 30, 0, 0, time.UTC),
"CallCost": map[string]interface{}{"Account": 1001},
}}
aPrflIDs, err := MatchingItemIDsForEvent(matchEV, nil, nil,
aPrflIDs, err := MatchingItemIDsForEvent(matchEV, nil, nil, nil,
dmMatch, utils.CacheAttributeFilterIndexes, tntCtx, true, true)
if err != nil {
t.Errorf("Error: %+v", err)
@@ -174,7 +174,7 @@ func TestFilterMatchingItemIDsForEvent2(t *testing.T) {
matchEV = utils.MapStorage{utils.MetaReq: map[string]interface{}{
"CallCost": map[string]interface{}{"Field": "profilePrefix"},
}}
aPrflIDs, err = MatchingItemIDsForEvent(matchEV, nil, nil,
aPrflIDs, err = MatchingItemIDsForEvent(matchEV, nil, nil, nil,
dmMatch, utils.CacheAttributeFilterIndexes, tntCtx, true, true)
if err != nil {
t.Errorf("Error: %+v", err)

View File

@@ -79,6 +79,7 @@ func (rS *RateS) matchingRateProfileForEvent(args *ArgsCostForEvent, rPfIDs []st
evNm,
rS.cfg.RateSCfg().StringIndexedFields,
rS.cfg.RateSCfg().PrefixIndexedFields,
rS.cfg.RateSCfg().SuffixIndexedFields,
rS.dm,
utils.CacheRateProfilesFilterIndexes,
args.CGREvent.Tenant,