diff --git a/apis/filter_indexes.go b/apis/filter_indexes.go index a4539d8e8..7176ad679 100644 --- a/apis/filter_indexes.go +++ b/apis/filter_indexes.go @@ -147,12 +147,7 @@ func (adms *AdminSv1) GetFilterIndexes(ctx *context.Context, arg *AttrGetFilterI if strings.HasPrefix(val, arg.FilterType) { indexesFilter[val] = strmap for _, value := range strmap.AsSlice() { - keyID := utils.ConcatenatedKey(val, value) - // for this case, we will not concatenate index:ID (e.g to avoid this case *exists:~*req.Account:::ProfileID) - if strings.HasPrefix(val, utils.MetaExists) || strings.HasPrefix(val, utils.MetaNotExists) { - keyID = val + value - } - indexedSlice = append(indexedSlice, keyID) + indexedSlice = append(indexedSlice, utils.ConcatenatedKey(val, value)) } } } @@ -167,12 +162,7 @@ func (adms *AdminSv1) GetFilterIndexes(ctx *context.Context, arg *AttrGetFilterI if strings.Contains(val, arg.FilterField) { indexesFilter[val] = strmap for _, value := range strmap.AsSlice() { - keyID := utils.ConcatenatedKey(val, value) - // for this case, we will not concatenate index:ID (e.g to avoid this case *exists:~*req.Account:::ProfileID) - if strings.HasPrefix(val, utils.MetaExists) || strings.HasPrefix(val, utils.MetaNotExists) { - keyID = val + value - } - indexedSlice = append(indexedSlice, keyID) + indexedSlice = append(indexedSlice, utils.ConcatenatedKey(val, value)) } } } @@ -184,12 +174,7 @@ func (adms *AdminSv1) GetFilterIndexes(ctx *context.Context, arg *AttrGetFilterI for val, strmap := range indexesFilter { if strings.Contains(val, arg.FilterField) { for _, value := range strmap.AsSlice() { - keyID := utils.ConcatenatedKey(val, value) - // for this case, we will not concatenate index:ID (e.g to avoid this case *exists:~*req.Account:::ProfileID) - if strings.HasPrefix(val, utils.MetaExists) || strings.HasPrefix(val, utils.MetaNotExists) { - keyID = val + value - } - cloneIndexSlice = append(cloneIndexSlice, keyID) + cloneIndexSlice = append(cloneIndexSlice, utils.ConcatenatedKey(val, value)) } } } @@ -204,12 +189,7 @@ func (adms *AdminSv1) GetFilterIndexes(ctx *context.Context, arg *AttrGetFilterI for val, strmap := range indexes { if strings.Contains(val, arg.FilterValue) { for _, value := range strmap.AsSlice() { - keyID := utils.ConcatenatedKey(val, value) - // for this case, we will not concatenate index:ID (e.g to avoid this case *exists:~*req.Account:::ProfileID) - if strings.HasPrefix(val, utils.MetaExists) || strings.HasPrefix(val, utils.MetaNotExists) { - keyID = val + value - } - indexedSlice = append(indexedSlice, keyID) + indexedSlice = append(indexedSlice, utils.ConcatenatedKey(val, value)) } } } @@ -221,12 +201,7 @@ func (adms *AdminSv1) GetFilterIndexes(ctx *context.Context, arg *AttrGetFilterI for val, strmap := range indexesFilter { if strings.Contains(val, arg.FilterValue) { for _, value := range strmap.AsSlice() { - keyID := utils.ConcatenatedKey(val, value) - // for this case, we will not concatenate index:ID (e.g to avoid this case *exists:~*req.Account:::ProfileID) - if strings.HasPrefix(val, utils.MetaExists) || strings.HasPrefix(val, utils.MetaNotExists) { - keyID = val + value - } - cloneIndexSlice = append(cloneIndexSlice, keyID) + cloneIndexSlice = append(cloneIndexSlice, utils.ConcatenatedKey(val, value)) } } } @@ -239,12 +214,7 @@ func (adms *AdminSv1) GetFilterIndexes(ctx *context.Context, arg *AttrGetFilterI if len(indexedSlice) == 0 { for val, strmap := range indexes { for _, value := range strmap.AsSlice() { - keyID := utils.ConcatenatedKey(val, value) - // for this case, we will not concatenate index:ID (e.g to avoid this case *exists:~*req.Account:::ProfileID) - if strings.HasPrefix(val, utils.MetaExists) || strings.HasPrefix(val, utils.MetaNotExists) { - keyID = val + value - } - indexedSlice = append(indexedSlice, keyID) + indexedSlice = append(indexedSlice, utils.ConcatenatedKey(val, value)) } } } diff --git a/apis/filter_indexes_it_test.go b/apis/filter_indexes_it_test.go index f2bcb7b6a..c495bf123 100644 --- a/apis/filter_indexes_it_test.go +++ b/apis/filter_indexes_it_test.go @@ -166,7 +166,7 @@ var ( }, { Type: utils.MetaExists, - Element: "~*req.NumberOfEvents:", + Element: "~*req.NumberOfEvents", }, }, }, @@ -188,7 +188,7 @@ var ( }, { Type: utils.MetaNotExists, - Element: "~*opts.*rateS:", + Element: "~*opts.*rateS", }, }, }, @@ -337,7 +337,7 @@ func testV1FIdxSetAttributeSProfileWithFltr(t *testing.T) { "*string:*opts.Subsystems:*attributes:TEST_ATTRIBUTES_IT_TEST", "*prefix:*req.Destinations:+0775:TEST_ATTRIBUTES_IT_TEST", "*prefix:*req.Destinations:+442:TEST_ATTRIBUTES_IT_TEST", - "*exists:*req.NumberOfEvents::TEST_ATTRIBUTES_IT_TEST"} + "*exists:*req.NumberOfEvents:*any:TEST_ATTRIBUTES_IT_TEST"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{ Tenant: utils.CGRateSorg, @@ -366,7 +366,7 @@ func testV1FIdxSetAttributeSProfileWithFltr(t *testing.T) { "*string:*req.CGRID:QWEASDZXC:TEST_ATTRIBUTES_IT_TEST", "*string:*req.CGRID:IOPJKLBNM:TEST_ATTRIBUTES_IT_TEST", "*string:*opts.Subsystems:*attributes:TEST_ATTRIBUTES_IT_TEST", - "*notexists:*opts.*rateS::TEST_ATTRIBUTES_IT_TEST"} + "*notexists:*opts.*rateS:*none:TEST_ATTRIBUTES_IT_TEST"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaAttributes}, &replyIdx); err != nil { @@ -444,7 +444,7 @@ func testV1FIdxSetAttributeSMoreFltrsMoreIndexing(t *testing.T) { "*string:*opts.*context:*sessions:TEST_ATTRIBUTES_IT_TEST", "*prefix:*req.AnswerTime:12:TEST_ATTRIBUTES_IT_TEST", "*prefix:*req.AnswerTime:33:TEST_ATTRIBUTES_IT_TEST", - "*exists:*req.NumberOfEvents::TEST_ATTRIBUTES_IT_TEST"} + "*exists:*req.NumberOfEvents:*any:TEST_ATTRIBUTES_IT_TEST"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaAttributes}, &replyIdx); err != nil { @@ -498,7 +498,7 @@ func testV1FIdxAttributeComputeIndexes(t *testing.T) { "*string:*opts.*context:*sessions:TEST_ATTRIBUTES_IT_TEST", "*prefix:*req.AnswerTime:12:TEST_ATTRIBUTES_IT_TEST", "*prefix:*req.AnswerTime:33:TEST_ATTRIBUTES_IT_TEST", - "*exists:*req.NumberOfEvents::TEST_ATTRIBUTES_IT_TEST"} + "*exists:*req.NumberOfEvents:*any:TEST_ATTRIBUTES_IT_TEST"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaAttributes}, &replyIdx); err != nil { t.Error(err) @@ -573,7 +573,7 @@ func testV1FIdxAttributeMoreProfilesForFilters(t *testing.T) { "*string:*req.Subject:22312:TEST_ATTRIBUTES_IT_TEST", "*string:*req.Subject:6774:TEST_ATTRIBUTES_IT_TEST", "*string:*req.Usage:123s:TEST_ATTRIBUTES_IT_TEST", - "*exists:*req.NumberOfEvents::TEST_ATTRIBUTES_IT_TEST"} + "*exists:*req.NumberOfEvents:*any:TEST_ATTRIBUTES_IT_TEST"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaAttributes}, &replyIdx); err != nil { t.Error(err) @@ -665,7 +665,7 @@ func testV1FIdxAttributeSRemoveComputedIndexesIDs(t *testing.T) { "*string:*req.Subject:6774:TEST_ATTRIBUTES_IT_TEST", "*string:*req.Usage:123s:TEST_ATTRIBUTES_IT_TEST", "*string:*req.Usage:123s:TEST_ATTRIBUTES_new_fltr", - "*exists:*req.NumberOfEvents::TEST_ATTRIBUTES_IT_TEST", + "*exists:*req.NumberOfEvents:*any:TEST_ATTRIBUTES_IT_TEST", } if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaAttributes}, &replyIdx); err != nil { @@ -719,7 +719,7 @@ func testV1FIdxAttributeRemoveIndexesComputeIndexesAllProfiles(t *testing.T) { "*string:*req.Subject:6774:TEST_ATTRIBUTES_IT_TEST", "*string:*req.Usage:123s:TEST_ATTRIBUTES_IT_TEST", "*string:*req.Usage:123s:TEST_ATTRIBUTES_new_fltr", - "*exists:*req.NumberOfEvents::TEST_ATTRIBUTES_IT_TEST", + "*exists:*req.NumberOfEvents:*any:TEST_ATTRIBUTES_IT_TEST", } var replyIdx []string if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, @@ -845,7 +845,7 @@ func testV1FIdxSetAccountWithFltr(t *testing.T) { "*string:*opts.Subsystems:*attributes:ACCOUNT_FILTER_INDEXES", "*prefix:*req.Destinations:+0775:ACCOUNT_FILTER_INDEXES", "*prefix:*req.Destinations:+442:ACCOUNT_FILTER_INDEXES", - "*exists:*req.NumberOfEvents::ACCOUNT_FILTER_INDEXES"} + "*exists:*req.NumberOfEvents:*any:ACCOUNT_FILTER_INDEXES"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaAccounts}, &replyIdx); err != nil { @@ -871,7 +871,7 @@ func testV1FIdxSetAccountWithFltr(t *testing.T) { "*string:*req.CGRID:QWEASDZXC:ACCOUNT_FILTER_INDEXES", "*string:*req.CGRID:IOPJKLBNM:ACCOUNT_FILTER_INDEXES", "*string:*opts.Subsystems:*attributes:ACCOUNT_FILTER_INDEXES", - "*notexists:*opts.*rateS::ACCOUNT_FILTER_INDEXES"} + "*notexists:*opts.*rateS:*none:ACCOUNT_FILTER_INDEXES"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaAccounts}, &replyIdx); err != nil { @@ -952,7 +952,7 @@ func testVF1FIdxSetAccountMoreFltrsMoreIndexing(t *testing.T) { "*string:*opts.*context:*sessions:ACCOUNT_FILTER_INDEXES", "*prefix:*req.AnswerTime:12:ACCOUNT_FILTER_INDEXES", "*prefix:*req.AnswerTime:33:ACCOUNT_FILTER_INDEXES", - "*exists:*req.NumberOfEvents::ACCOUNT_FILTER_INDEXES"} + "*exists:*req.NumberOfEvents:*any:ACCOUNT_FILTER_INDEXES"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaAccounts}, &replyIdx); err != nil { @@ -1008,7 +1008,7 @@ func testV1FIdxAccountComputeIndexes(t *testing.T) { "*string:*opts.*context:*sessions:ACCOUNT_FILTER_INDEXES", "*prefix:*req.AnswerTime:12:ACCOUNT_FILTER_INDEXES", "*prefix:*req.AnswerTime:33:ACCOUNT_FILTER_INDEXES", - "*exists:*req.NumberOfEvents::ACCOUNT_FILTER_INDEXES"} + "*exists:*req.NumberOfEvents:*any:ACCOUNT_FILTER_INDEXES"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaAccounts}, &replyIdx); err != nil { t.Error(err) @@ -1090,8 +1090,8 @@ func testV1FIdxAccountsMoreProfilesForFilters(t *testing.T) { "*string:*opts.Subsystems:*attributes:ACCOUNT_FILTER_INDEXES3", "*prefix:*req.Destinations:+0775:ACCOUNT_FILTER_INDEXES3", "*prefix:*req.Destinations:+442:ACCOUNT_FILTER_INDEXES3", - "*exists:*req.NumberOfEvents::ACCOUNT_FILTER_INDEXES", - "*exists:*req.NumberOfEvents::ACCOUNT_FILTER_INDEXES3"} + "*exists:*req.NumberOfEvents:*any:ACCOUNT_FILTER_INDEXES", + "*exists:*req.NumberOfEvents:*any:ACCOUNT_FILTER_INDEXES3"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaAccounts}, &replyIdx); err != nil { t.Error(err) @@ -1150,7 +1150,7 @@ func testV1FIdxAccountSRemoveComputedIndexesIDs(t *testing.T) { "*string:*opts.Subsystems:*attributes:ACCOUNT_FILTER_INDEXES", "*prefix:*req.Destinations:+0775:ACCOUNT_FILTER_INDEXES", "*prefix:*req.Destinations:+442:ACCOUNT_FILTER_INDEXES", - "*exists:*req.NumberOfEvents::ACCOUNT_FILTER_INDEXES"} + "*exists:*req.NumberOfEvents:*any:ACCOUNT_FILTER_INDEXES"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaAccounts}, &replyIdx); err != nil { @@ -1194,8 +1194,8 @@ func testV1FIdxAccountSRemoveComputedIndexesIDs(t *testing.T) { "*string:*opts.Subsystems:*attributes:ACCOUNT_FILTER_INDEXES3", "*prefix:*req.Destinations:+0775:ACCOUNT_FILTER_INDEXES3", "*prefix:*req.Destinations:+442:ACCOUNT_FILTER_INDEXES3", - "*exists:*req.NumberOfEvents::ACCOUNT_FILTER_INDEXES", - "*exists:*req.NumberOfEvents::ACCOUNT_FILTER_INDEXES3"} + "*exists:*req.NumberOfEvents:*any:ACCOUNT_FILTER_INDEXES", + "*exists:*req.NumberOfEvents:*any:ACCOUNT_FILTER_INDEXES3"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaAccounts}, &replyIdx); err != nil { @@ -1309,7 +1309,7 @@ func testV1FIdxSetActionProfileWithFltr(t *testing.T) { "*string:*opts.Subsystems:*attributes:REM_ACC", "*prefix:*req.Destinations:+0775:REM_ACC", "*prefix:*req.Destinations:+442:REM_ACC", - "*exists:*req.NumberOfEvents::REM_ACC"} + "*exists:*req.NumberOfEvents:*any:REM_ACC"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaActions}, &replyIdx); err != nil { @@ -1335,7 +1335,7 @@ func testV1FIdxSetActionProfileWithFltr(t *testing.T) { "*string:*req.CGRID:QWEASDZXC:REM_ACC", "*string:*req.CGRID:IOPJKLBNM:REM_ACC", "*string:*opts.Subsystems:*attributes:REM_ACC", - "*notexists:*opts.*rateS::REM_ACC"} + "*notexists:*opts.*rateS:*none:REM_ACC"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaActions}, &replyIdx); err != nil { @@ -1419,7 +1419,7 @@ func testV1FIdxSetActionProfileMoreFltrsMoreIndexing(t *testing.T) { "*string:*req.Account:1001:REM_ACC", "*prefix:*req.AnswerTime:12:REM_ACC", "*prefix:*req.AnswerTime:33:REM_ACC", - "*exists:*req.NumberOfEvents::REM_ACC"} + "*exists:*req.NumberOfEvents:*any:REM_ACC"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaActions}, &replyIdx); err != nil { @@ -1474,7 +1474,7 @@ func testV1FIdxActionProfileComputeIndexes(t *testing.T) { "*string:*req.Account:1001:REM_ACC", "*prefix:*req.AnswerTime:12:REM_ACC", "*prefix:*req.AnswerTime:33:REM_ACC", - "*exists:*req.NumberOfEvents::REM_ACC"} + "*exists:*req.NumberOfEvents:*any:REM_ACC"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaActions}, &replyIdx); err != nil { t.Error(err) @@ -1569,8 +1569,8 @@ func testV1FIdxActionMoreProfileForFilters(t *testing.T) { "*string:*opts.Subsystems:*attributes:SET_BAL", "*prefix:*req.Destinations:+0775:SET_BAL", "*prefix:*req.Destinations:+442:SET_BAL", - "*exists:*req.NumberOfEvents::REM_ACC", - "*exists:*req.NumberOfEvents::SET_BAL"} + "*exists:*req.NumberOfEvents:*any:REM_ACC", + "*exists:*req.NumberOfEvents:*any:SET_BAL"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaActions}, &replyIdx); err != nil { t.Error(err) @@ -1630,7 +1630,7 @@ func testV1FIdxActionSRemoveComputedIndexesIDs(t *testing.T) { "*string:*opts.Subsystems:*attributes:REM_ACC", "*prefix:*req.Destinations:+0775:REM_ACC", "*prefix:*req.Destinations:+442:REM_ACC", - "*exists:*req.NumberOfEvents::REM_ACC"} + "*exists:*req.NumberOfEvents:*any:REM_ACC"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaActions}, &replyIdx); err != nil { @@ -1674,8 +1674,8 @@ func testV1FIdxActionSRemoveComputedIndexesIDs(t *testing.T) { "*string:*opts.Subsystems:*attributes:SET_BAL", "*prefix:*req.Destinations:+0775:SET_BAL", "*prefix:*req.Destinations:+442:SET_BAL", - "*exists:*req.NumberOfEvents::SET_BAL", - "*exists:*req.NumberOfEvents::REM_ACC"} + "*exists:*req.NumberOfEvents:*any:SET_BAL", + "*exists:*req.NumberOfEvents:*any:REM_ACC"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaActions}, &replyIdx); err != nil { @@ -1774,7 +1774,7 @@ func testV1FIdxSetChargerSProfileWithFltr(t *testing.T) { "*string:*opts.Subsystems:*attributes:1001_Charger", "*prefix:*req.Destinations:+0775:1001_Charger", "*prefix:*req.Destinations:+442:1001_Charger", - "*exists:*req.NumberOfEvents::1001_Charger"} + "*exists:*req.NumberOfEvents:*any:1001_Charger"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaChargers}, &replyIdx); err != nil { @@ -1800,7 +1800,7 @@ func testV1FIdxSetChargerSProfileWithFltr(t *testing.T) { "*string:*req.CGRID:QWEASDZXC:1001_Charger", "*string:*req.CGRID:IOPJKLBNM:1001_Charger", "*string:*opts.Subsystems:*attributes:1001_Charger", - "*notexists:*opts.*rateS::1001_Charger"} + "*notexists:*opts.*rateS:*none:1001_Charger"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaChargers}, &replyIdx); err != nil { @@ -1870,7 +1870,7 @@ func testV1FIdxSetChargerProfileMoreFltrsMoreIndexing(t *testing.T) { "*string:*req.Account:1001:1001_Charger", "*prefix:*req.AnswerTime:12:1001_Charger", "*prefix:*req.AnswerTime:33:1001_Charger", - "*exists:*req.NumberOfEvents::1001_Charger"} + "*exists:*req.NumberOfEvents:*any:1001_Charger"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaChargers}, &replyIdx); err != nil { @@ -1926,7 +1926,7 @@ func testV1FIdxChargerProfileComputeIndexes(t *testing.T) { "*string:*req.Account:1001:1001_Charger", "*prefix:*req.AnswerTime:12:1001_Charger", "*prefix:*req.AnswerTime:33:1001_Charger", - "*exists:*req.NumberOfEvents::1001_Charger"} + "*exists:*req.NumberOfEvents:*any:1001_Charger"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaChargers}, &replyIdx); err != nil { t.Error(err) @@ -1996,8 +1996,8 @@ func testV1FIdxChargerMoreProfileForFilters(t *testing.T) { "*string:*opts.Subsystems:*attributes:1001_Charger_3", "*prefix:*req.Destinations:+0775:1001_Charger_3", "*prefix:*req.Destinations:+442:1001_Charger_3", - "*exists:*req.NumberOfEvents::1001_Charger", - "*exists:*req.NumberOfEvents::1001_Charger_3"} + "*exists:*req.NumberOfEvents:*any:1001_Charger", + "*exists:*req.NumberOfEvents:*any:1001_Charger_3"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaChargers}, &replyIdx); err != nil { t.Error(err) @@ -2057,7 +2057,7 @@ func testV1FIdxChargerSRemoveComputedIndexesIDs(t *testing.T) { "*string:*opts.Subsystems:*attributes:1001_Charger", "*prefix:*req.Destinations:+0775:1001_Charger", "*prefix:*req.Destinations:+442:1001_Charger", - "*exists:*req.NumberOfEvents::1001_Charger"} + "*exists:*req.NumberOfEvents:*any:1001_Charger"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaChargers}, &replyIdx); err != nil { @@ -2101,8 +2101,8 @@ func testV1FIdxChargerSRemoveComputedIndexesIDs(t *testing.T) { "*string:*opts.Subsystems:*attributes:1001_Charger_3", "*prefix:*req.Destinations:+0775:1001_Charger_3", "*prefix:*req.Destinations:+442:1001_Charger_3", - "*exists:*req.NumberOfEvents::1001_Charger", - "*exists:*req.NumberOfEvents::1001_Charger_3"} + "*exists:*req.NumberOfEvents:*any:1001_Charger", + "*exists:*req.NumberOfEvents:*any:1001_Charger_3"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaChargers}, &replyIdx); err != nil { @@ -2211,7 +2211,7 @@ func testV1FIdxSetRateSProfileWithFltr(t *testing.T) { "*string:*opts.Subsystems:*attributes:RATE_1", "*prefix:*req.Destinations:+0775:RATE_1", "*prefix:*req.Destinations:+442:RATE_1", - "*exists:*req.NumberOfEvents::RATE_1"} + "*exists:*req.NumberOfEvents:*any:RATE_1"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaRateProfiles}, &replyIdx); err != nil { @@ -2237,7 +2237,7 @@ func testV1FIdxSetRateSProfileWithFltr(t *testing.T) { "*string:*req.CGRID:QWEASDZXC:RATE_1", "*string:*req.CGRID:IOPJKLBNM:RATE_1", "*string:*opts.Subsystems:*attributes:RATE_1", - "*notexists:*opts.*rateS::RATE_1"} + "*notexists:*opts.*rateS:*none:RATE_1"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaRateProfiles}, &replyIdx); err != nil { @@ -2316,7 +2316,7 @@ func testV1FIdxSetRateProfileMoreFltrsMoreIndexing(t *testing.T) { "*string:*req.Account:1001:RATE_1", "*prefix:*req.AnswerTime:12:RATE_1", "*prefix:*req.AnswerTime:33:RATE_1", - "*exists:*req.NumberOfEvents::RATE_1"} + "*exists:*req.NumberOfEvents:*any:RATE_1"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaRateProfiles}, &replyIdx); err != nil { @@ -2372,7 +2372,7 @@ func testV1FIdxRateSProfileComputeIndexes(t *testing.T) { "*string:*req.Account:1001:RATE_1", "*prefix:*req.AnswerTime:12:RATE_1", "*prefix:*req.AnswerTime:33:RATE_1", - "*exists:*req.NumberOfEvents::RATE_1"} + "*exists:*req.NumberOfEvents:*any:RATE_1"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaRateProfiles}, &replyIdx); err != nil { t.Error(err) @@ -2465,8 +2465,8 @@ func testV1FIdxRateSProfileMoreProfilesForFilters(t *testing.T) { "*string:*opts.Subsystems:*attributes:RATE_3", "*prefix:*req.Destinations:+0775:RATE_3", "*prefix:*req.Destinations:+442:RATE_3", - "*exists:*req.NumberOfEvents::RATE_1", - "*exists:*req.NumberOfEvents::RATE_3"} + "*exists:*req.NumberOfEvents:*any:RATE_1", + "*exists:*req.NumberOfEvents:*any:RATE_3"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaRateProfiles}, &replyIdx); err != nil { t.Error(err) @@ -2526,7 +2526,7 @@ func testV1FIdxRateSRemoveComputedIndexesIDs(t *testing.T) { "*string:*opts.Subsystems:*attributes:RATE_1", "*prefix:*req.Destinations:+0775:RATE_1", "*prefix:*req.Destinations:+442:RATE_1", - "*exists:*req.NumberOfEvents::RATE_1"} + "*exists:*req.NumberOfEvents:*any:RATE_1"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaRateProfiles}, &replyIdx); err != nil { @@ -2569,8 +2569,8 @@ func testV1FIdxRateSRemoveComputedIndexesIDs(t *testing.T) { "*string:*opts.Subsystems:*attributes:RATE_3", "*prefix:*req.Destinations:+0775:RATE_3", "*prefix:*req.Destinations:+442:RATE_3", - "*exists:*req.NumberOfEvents::RATE_1", - "*exists:*req.NumberOfEvents::RATE_3"} + "*exists:*req.NumberOfEvents:*any:RATE_1", + "*exists:*req.NumberOfEvents:*any:RATE_3"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaRateProfiles}, &replyIdx); err != nil { @@ -2691,7 +2691,7 @@ func testV1FIdxRateSProfileRatesWithFltr(t *testing.T) { "*string:*opts.Subsystems:*attributes:RT_ALWAYS", "*prefix:*req.Destinations:+0775:RT_ALWAYS", "*prefix:*req.Destinations:+442:RT_ALWAYS", - "*exists:*req.NumberOfEvents::RT_ALWAYS"} + "*exists:*req.NumberOfEvents:*any:RT_ALWAYS"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaRateProfileRates, Context: "RATE_1"}, @@ -2719,7 +2719,7 @@ func testV1FIdxRateSProfileRatesWithFltr(t *testing.T) { "*string:*req.RequestType:*prepaid:RT_ALWAYS", "*string:*req.RequestType:*postpaid:RT_CHRISTMAS", "*string:*opts.Subsystems:*attributes:RT_ALWAYS", - "*notexists:*opts.*rateS::RT_ALWAYS"} + "*notexists:*opts.*rateS:*none:RT_ALWAYS"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaRateProfileRates, Context: "RATE_1"}, &replyIdx); err != nil { @@ -2810,7 +2810,7 @@ func testV1FIdxSetRatePofileRatesMoreFltrsMoreIndexing(t *testing.T) { "*prefix:*req.AnswerTime:12:RT_CHRISTMAS", "*prefix:*req.AnswerTime:33:RT_CHRISTMAS", "*string:*req.Usage:123s:RT_ALWAYS", - "*exists:*req.NumberOfEvents::RT_ALWAYS"} + "*exists:*req.NumberOfEvents:*any:RT_ALWAYS"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaRateProfileRates, Context: "RATE_1"}, @@ -2869,7 +2869,7 @@ func testV1FIdxRateProfileRatesComputeIndexes(t *testing.T) { "*prefix:*req.AnswerTime:12:RT_CHRISTMAS", "*prefix:*req.AnswerTime:33:RT_CHRISTMAS", "*string:*req.Usage:123s:RT_ALWAYS", - "*exists:*req.NumberOfEvents::RT_ALWAYS"} + "*exists:*req.NumberOfEvents:*any:RT_ALWAYS"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaRateProfileRates, Context: "RATE_1"}, &replyIdx); err != nil { @@ -2987,8 +2987,8 @@ func testV1FIdxRateProfileRatesMoreRatesForFilters(t *testing.T) { "*string:*opts.Subsystems:*attributes:RT_GOLDEN_HOUR", "*prefix:*req.Destinations:+0775:RT_GOLDEN_HOUR", "*prefix:*req.Destinations:+442:RT_GOLDEN_HOUR", - "*exists:*req.NumberOfEvents::RT_GOLDEN_HOUR", - "*exists:*req.NumberOfEvents::RT_ALWAYS"} + "*exists:*req.NumberOfEvents:*any:RT_GOLDEN_HOUR", + "*exists:*req.NumberOfEvents:*any:RT_ALWAYS"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaRateProfileRates, Context: "RATE_1"}, &replyIdx); err != nil { @@ -3014,7 +3014,7 @@ func testV1FIdxRateProfileRatesMoreRatesForFilters(t *testing.T) { "*string:*opts.Subsystems:*attributes:RT_ALWAYS_2", "*prefix:*req.Destinations:+0775:RT_ALWAYS_2", "*prefix:*req.Destinations:+442:RT_ALWAYS_2", - "*exists:*req.NumberOfEvents::RT_ALWAYS_2"} + "*exists:*req.NumberOfEvents:*any:RT_ALWAYS_2"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaRateProfileRates, Context: "RATE_2"}, &replyIdx); err != nil { @@ -3097,8 +3097,8 @@ func testV1FIdxRateProfileRatesRemoveComputedIndexesIDs(t *testing.T) { "*string:*opts.Subsystems:*attributes:RT_GOLDEN_HOUR", "*prefix:*req.Destinations:+0775:RT_GOLDEN_HOUR", "*prefix:*req.Destinations:+442:RT_GOLDEN_HOUR", - "*exists:*req.NumberOfEvents::RT_GOLDEN_HOUR", - "*exists:*req.NumberOfEvents::RT_ALWAYS"} + "*exists:*req.NumberOfEvents:*any:RT_GOLDEN_HOUR", + "*exists:*req.NumberOfEvents:*any:RT_ALWAYS"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaRateProfileRates, Context: "RATE_1"}, &replyIdx); err != nil { @@ -3131,7 +3131,7 @@ func testV1FIdxRateProfileRatesRemoveComputedIndexesIDs(t *testing.T) { "*string:*opts.Subsystems:*attributes:RT_ALWAYS_2", "*prefix:*req.Destinations:+0775:RT_ALWAYS_2", "*prefix:*req.Destinations:+442:RT_ALWAYS_2", - "*exists:*req.NumberOfEvents::RT_ALWAYS_2"} + "*exists:*req.NumberOfEvents:*any:RT_ALWAYS_2"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaRateProfileRates, Context: "RATE_2"}, &replyIdx); err != nil { @@ -3173,7 +3173,7 @@ func testV1FIdxRateProfileRatesRemoveRateProfileRatesNoIndexes(t *testing.T) { "*string:*req.Usage:123s:RT_WEEKEND", "*prefix:*req.AnswerTime:12:RT_WEEKEND", "*prefix:*req.AnswerTime:33:RT_WEEKEND", - "*exists:*req.NumberOfEvents::RT_ALWAYS"} + "*exists:*req.NumberOfEvents:*any:RT_ALWAYS"} var replyIdx []string if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaRateProfileRates, @@ -3286,7 +3286,7 @@ func testV1FIdxSetResourceSProfileWithFltr(t *testing.T) { "*string:*opts.Subsystems:*attributes:RESOURCE1", "*prefix:*req.Destinations:+0775:RESOURCE1", "*prefix:*req.Destinations:+442:RESOURCE1", - "*exists:*req.NumberOfEvents::RESOURCE1"} + "*exists:*req.NumberOfEvents:*any:RESOURCE1"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaResources}, &replyIdx); err != nil { @@ -3312,7 +3312,7 @@ func testV1FIdxSetResourceSProfileWithFltr(t *testing.T) { "*string:*req.CGRID:QWEASDZXC:RESOURCE1", "*string:*req.CGRID:IOPJKLBNM:RESOURCE1", "*string:*opts.Subsystems:*attributes:RESOURCE1", - "*notexists:*opts.*rateS::RESOURCE1"} + "*notexists:*opts.*rateS:*none:RESOURCE1"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaResources}, &replyIdx); err != nil { @@ -3383,7 +3383,7 @@ func testV1FIdxSetResourceSMoreFltrsMoreIndexing(t *testing.T) { "*string:*req.Account:1001:RESOURCE1", "*prefix:*req.AnswerTime:12:RESOURCE1", "*prefix:*req.AnswerTime:33:RESOURCE1", - "*exists:*req.NumberOfEvents::RESOURCE1"} + "*exists:*req.NumberOfEvents:*any:RESOURCE1"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaResources}, &replyIdx); err != nil { @@ -3439,7 +3439,7 @@ func testV1FIdxResourceSProfileComputeIndexes(t *testing.T) { "*string:*req.Account:1001:RESOURCE1", "*prefix:*req.AnswerTime:12:RESOURCE1", "*prefix:*req.AnswerTime:33:RESOURCE1", - "*exists:*req.NumberOfEvents::RESOURCE1"} + "*exists:*req.NumberOfEvents:*any:RESOURCE1"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaResources}, &replyIdx); err != nil { t.Error(err) @@ -3511,8 +3511,8 @@ func testV1FIdxResourceSMoreProfilesForFltrs(t *testing.T) { "*string:*opts.Subsystems:*attributes:RESOURCE3", "*prefix:*req.Destinations:+0775:RESOURCE3", "*prefix:*req.Destinations:+442:RESOURCE3", - "*exists:*req.NumberOfEvents::RESOURCE1", - "*exists:*req.NumberOfEvents::RESOURCE3"} + "*exists:*req.NumberOfEvents:*any:RESOURCE1", + "*exists:*req.NumberOfEvents:*any:RESOURCE3"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaResources}, &replyIdx); err != nil { t.Error(err) @@ -3571,7 +3571,7 @@ func testV1FIdxResourceSRemoveComputedIndexesIDs(t *testing.T) { "*string:*opts.Subsystems:*attributes:RESOURCE1", "*prefix:*req.Destinations:+0775:RESOURCE1", "*prefix:*req.Destinations:+442:RESOURCE1", - "*exists:*req.NumberOfEvents::RESOURCE1"} + "*exists:*req.NumberOfEvents:*any:RESOURCE1"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaResources}, &replyIdx); err != nil { @@ -3614,8 +3614,8 @@ func testV1FIdxResourceSRemoveComputedIndexesIDs(t *testing.T) { "*string:*opts.Subsystems:*attributes:RESOURCE3", "*prefix:*req.Destinations:+0775:RESOURCE3", "*prefix:*req.Destinations:+442:RESOURCE3", - "*exists:*req.NumberOfEvents::RESOURCE1", - "*exists:*req.NumberOfEvents::RESOURCE3"} + "*exists:*req.NumberOfEvents:*any:RESOURCE1", + "*exists:*req.NumberOfEvents:*any:RESOURCE3"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaResources}, &replyIdx); err != nil { t.Error(err) @@ -3726,7 +3726,7 @@ func testV1FIdxSetRouteSProfileWithFltr(t *testing.T) { "*string:*opts.Subsystems:*attributes:ROUTE_1", "*prefix:*req.Destinations:+0775:ROUTE_1", "*prefix:*req.Destinations:+442:ROUTE_1", - "*exists:*req.NumberOfEvents::ROUTE_1"} + "*exists:*req.NumberOfEvents:*any:ROUTE_1"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaRoutes}, &replyIdx); err != nil { @@ -3752,7 +3752,7 @@ func testV1FIdxSetRouteSProfileWithFltr(t *testing.T) { "*string:*req.CGRID:QWEASDZXC:ROUTE_1", "*string:*req.CGRID:IOPJKLBNM:ROUTE_1", "*string:*opts.Subsystems:*attributes:ROUTE_1", - "*notexists:*opts.*rateS::ROUTE_1"} + "*notexists:*opts.*rateS:*none:ROUTE_1"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaRoutes}, &replyIdx); err != nil { @@ -3831,7 +3831,7 @@ func testV1FIdxSetRouteSMoreFltrsMoreIndexing(t *testing.T) { "*string:*req.Account:1001:ROUTE_1", "*prefix:*req.AnswerTime:12:ROUTE_1", "*prefix:*req.AnswerTime:33:ROUTE_1", - "*exists:*req.NumberOfEvents::ROUTE_1"} + "*exists:*req.NumberOfEvents:*any:ROUTE_1"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaRoutes}, &replyIdx); err != nil { @@ -3886,7 +3886,7 @@ func testV1FIdxRouteSProfileComputeIndexes(t *testing.T) { "*string:*req.Account:1001:ROUTE_1", "*prefix:*req.AnswerTime:12:ROUTE_1", "*prefix:*req.AnswerTime:33:ROUTE_1", - "*exists:*req.NumberOfEvents::ROUTE_1"} + "*exists:*req.NumberOfEvents:*any:ROUTE_1"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaRoutes}, &replyIdx); err != nil { t.Error(err) @@ -3970,8 +3970,8 @@ func testV1FIdxRouteSMoreProfilesForFltrs(t *testing.T) { "*string:*opts.Subsystems:*attributes:ROUTE_3", "*prefix:*req.Destinations:+0775:ROUTE_3", "*prefix:*req.Destinations:+442:ROUTE_3", - "*exists:*req.NumberOfEvents::ROUTE_1", - "*exists:*req.NumberOfEvents::ROUTE_3"} + "*exists:*req.NumberOfEvents:*any:ROUTE_1", + "*exists:*req.NumberOfEvents:*any:ROUTE_3"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaRoutes}, &replyIdx); err != nil { t.Error(err) @@ -4031,7 +4031,7 @@ func testV1FIdxRouteSRemoveComputedIndexesIDs(t *testing.T) { "*string:*opts.Subsystems:*attributes:ROUTE_1", "*prefix:*req.Destinations:+0775:ROUTE_1", "*prefix:*req.Destinations:+442:ROUTE_1", - "*exists:*req.NumberOfEvents::ROUTE_1"} + "*exists:*req.NumberOfEvents:*any:ROUTE_1"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaRoutes}, &replyIdx); err != nil { @@ -4074,8 +4074,8 @@ func testV1FIdxRouteSRemoveComputedIndexesIDs(t *testing.T) { "*string:*opts.Subsystems:*attributes:ROUTE_3", "*prefix:*req.Destinations:+0775:ROUTE_3", "*prefix:*req.Destinations:+442:ROUTE_3", - "*exists:*req.NumberOfEvents::ROUTE_1", - "*exists:*req.NumberOfEvents::ROUTE_3"} + "*exists:*req.NumberOfEvents:*any:ROUTE_1", + "*exists:*req.NumberOfEvents:*any:ROUTE_3"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaRoutes}, &replyIdx); err != nil { t.Error(err) @@ -4185,7 +4185,7 @@ func testV1FIdxSetStatSProfileWithFltr(t *testing.T) { "*string:*opts.Subsystems:*attributes:Stat_1", "*prefix:*req.Destinations:+0775:Stat_1", "*prefix:*req.Destinations:+442:Stat_1", - "*exists:*req.NumberOfEvents::Stat_1"} + "*exists:*req.NumberOfEvents:*any:Stat_1"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaStats}, &replyIdx); err != nil { @@ -4210,7 +4210,7 @@ func testV1FIdxSetStatSProfileWithFltr(t *testing.T) { "*string:*req.CGRID:QWEASDZXC:Stat_1", "*string:*req.CGRID:IOPJKLBNM:Stat_1", "*string:*opts.Subsystems:*attributes:Stat_1", - "*notexists:*opts.*rateS::Stat_1"} + "*notexists:*opts.*rateS:*none:Stat_1"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaStats}, &replyIdx); err != nil { @@ -4289,7 +4289,7 @@ func testV1FIdxSetStatSMoreFltrsMoreIndexing(t *testing.T) { "*string:*req.Account:1001:Stat_1", "*prefix:*req.AnswerTime:12:Stat_1", "*prefix:*req.AnswerTime:33:Stat_1", - "*exists:*req.NumberOfEvents::Stat_1"} + "*exists:*req.NumberOfEvents:*any:Stat_1"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaStats}, &replyIdx); err != nil { @@ -4344,7 +4344,7 @@ func testV1FIdxStatSProfileComputeIndexes(t *testing.T) { "*string:*req.Account:1001:Stat_1", "*prefix:*req.AnswerTime:12:Stat_1", "*prefix:*req.AnswerTime:33:Stat_1", - "*exists:*req.NumberOfEvents::Stat_1"} + "*exists:*req.NumberOfEvents:*any:Stat_1"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaStats}, &replyIdx); err != nil { t.Error(err) @@ -4427,8 +4427,8 @@ func testV1FIdxStatSMoreProfilesForFltrs(t *testing.T) { "*string:*opts.Subsystems:*attributes:Stat_3", "*prefix:*req.Destinations:+0775:Stat_3", "*prefix:*req.Destinations:+442:Stat_3", - "*exists:*req.NumberOfEvents::Stat_1", - "*exists:*req.NumberOfEvents::Stat_3"} + "*exists:*req.NumberOfEvents:*any:Stat_1", + "*exists:*req.NumberOfEvents:*any:Stat_3"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaStats}, &replyIdx); err != nil { t.Error(err) @@ -4488,7 +4488,7 @@ func testV1FIdxStatSRemoveComputedIndexesIDs(t *testing.T) { "*string:*opts.Subsystems:*attributes:Stat_1", "*prefix:*req.Destinations:+0775:Stat_1", "*prefix:*req.Destinations:+442:Stat_1", - "*exists:*req.NumberOfEvents::Stat_1"} + "*exists:*req.NumberOfEvents:*any:Stat_1"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaStats}, &replyIdx); err != nil { @@ -4531,8 +4531,8 @@ func testV1FIdxStatSRemoveComputedIndexesIDs(t *testing.T) { "*string:*opts.Subsystems:*attributes:Stat_3", "*prefix:*req.Destinations:+0775:Stat_3", "*prefix:*req.Destinations:+442:Stat_3", - "*exists:*req.NumberOfEvents::Stat_1", - "*exists:*req.NumberOfEvents::Stat_3"} + "*exists:*req.NumberOfEvents:*any:Stat_1", + "*exists:*req.NumberOfEvents:*any:Stat_3"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaStats}, &replyIdx); err != nil { t.Error(err) @@ -4633,7 +4633,7 @@ func testV1FIdxSetThresholdProfileWithFltr(t *testing.T) { "*string:*opts.Subsystems:*attributes:THD_ACNT_1001", "*prefix:*req.Destinations:+0775:THD_ACNT_1001", "*prefix:*req.Destinations:+442:THD_ACNT_1001", - "*exists:*req.NumberOfEvents::THD_ACNT_1001"} + "*exists:*req.NumberOfEvents:*any:THD_ACNT_1001"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaThresholds}, &replyIdx); err != nil { @@ -4659,7 +4659,7 @@ func testV1FIdxSetThresholdProfileWithFltr(t *testing.T) { "*string:*req.CGRID:QWEASDZXC:THD_ACNT_1001", "*string:*req.CGRID:IOPJKLBNM:THD_ACNT_1001", "*string:*opts.Subsystems:*attributes:THD_ACNT_1001", - "*notexists:*opts.*rateS::THD_ACNT_1001"} + "*notexists:*opts.*rateS:*none:THD_ACNT_1001"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaThresholds}, &replyIdx); err != nil { @@ -4729,7 +4729,7 @@ func testV1FIdxSetThresholdSMoreFltrsMoreIndexing(t *testing.T) { "*string:*req.Account:1001:THD_ACNT_1001", "*prefix:*req.AnswerTime:12:THD_ACNT_1001", "*prefix:*req.AnswerTime:33:THD_ACNT_1001", - "*exists:*req.NumberOfEvents::THD_ACNT_1001"} + "*exists:*req.NumberOfEvents:*any:THD_ACNT_1001"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaThresholds}, &replyIdx); err != nil { @@ -4784,7 +4784,7 @@ func testV1FIdxThresholdSProfileComputeIndexes(t *testing.T) { "*string:*req.Account:1001:THD_ACNT_1001", "*prefix:*req.AnswerTime:12:THD_ACNT_1001", "*prefix:*req.AnswerTime:33:THD_ACNT_1001", - "*exists:*req.NumberOfEvents::THD_ACNT_1001"} + "*exists:*req.NumberOfEvents:*any:THD_ACNT_1001"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaThresholds}, &replyIdx); err != nil { t.Error(err) @@ -4859,8 +4859,8 @@ func testV1FIdxThresholdsSMoreProfilesForFltrs(t *testing.T) { "*string:*opts.Subsystems:*attributes:THD_ACNT_1003", "*prefix:*req.Destinations:+0775:THD_ACNT_1003", "*prefix:*req.Destinations:+442:THD_ACNT_1003", - "*exists:*req.NumberOfEvents::THD_ACNT_1001", - "*exists:*req.NumberOfEvents::THD_ACNT_1003"} + "*exists:*req.NumberOfEvents:*any:THD_ACNT_1001", + "*exists:*req.NumberOfEvents:*any:THD_ACNT_1003"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaThresholds}, &replyIdx); err != nil { t.Error(err) @@ -4914,7 +4914,7 @@ func testV1FIdxTThresholdSRemoveComputedIndexesIDs(t *testing.T) { "*string:*opts.Subsystems:*attributes:THD_ACNT_1001", "*prefix:*req.Destinations:+0775:THD_ACNT_1001", "*prefix:*req.Destinations:+442:THD_ACNT_1001", - "*exists:*req.NumberOfEvents::THD_ACNT_1001"} + "*exists:*req.NumberOfEvents:*any:THD_ACNT_1001"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaThresholds}, &replyIdx); err != nil { @@ -4957,8 +4957,8 @@ func testV1FIdxTThresholdSRemoveComputedIndexesIDs(t *testing.T) { "*string:*opts.Subsystems:*attributes:THD_ACNT_1003", "*prefix:*req.Destinations:+0775:THD_ACNT_1003", "*prefix:*req.Destinations:+442:THD_ACNT_1003", - "*exists:*req.NumberOfEvents::THD_ACNT_1001", - "*exists:*req.NumberOfEvents::THD_ACNT_1003"} + "*exists:*req.NumberOfEvents:*any:THD_ACNT_1001", + "*exists:*req.NumberOfEvents:*any:THD_ACNT_1003"} if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1GetFilterIndexes, &AttrGetFilterIndexes{Tenant: utils.CGRateSorg, ItemType: utils.MetaThresholds}, &replyIdx); err != nil { t.Error(err) diff --git a/data/conf/samples/attributes_mysql/cgrates.json b/data/conf/samples/attributes_mysql/cgrates.json index f0ad636a3..6a8f1e865 100644 --- a/data/conf/samples/attributes_mysql/cgrates.json +++ b/data/conf/samples/attributes_mysql/cgrates.json @@ -16,10 +16,11 @@ "attributes": { "enabled": true, "prefix_indexed_fields": ["*req.Destination"], - "exists_indexed_fields": ["*opts.*usage"], + "exists_indexed_fields": ["*opts.*usage"], }, "admins": { "enabled": true, } -}, \ No newline at end of file + +} \ No newline at end of file diff --git a/engine/filterhelpers.go b/engine/filterhelpers.go index b8244804d..6610728b4 100644 --- a/engine/filterhelpers.go +++ b/engine/filterhelpers.go @@ -19,8 +19,6 @@ along with this program. If not, see package engine import ( - "strings" - "github.com/cgrates/birpc/context" "github.com/cgrates/cgrates/config" "github.com/cgrates/cgrates/guardian" @@ -61,6 +59,9 @@ func MatchingItemIDsForEvent(ctx *context.Context, ev utils.MapStorage, stringFl for _, fldName := range *fieldIDs { var fieldValIf interface{} fieldValIf, err = ev.FieldAsInterface(utils.SplitPath(fldName, utils.NestingSep[0], -1)) + if err == nil && filterIndexTypes[i] == utils.MetaNotExists { + continue // field should not exist in our event in order to check index + } if err != nil && filterIndexTypes[i] != utils.MetaNone { continue } @@ -76,18 +77,14 @@ func MatchingItemIDsForEvent(ctx *context.Context, ev utils.MapStorage, stringFl fldVals = utils.SplitPrefix(fldVal, 1) // all prefixes till last digit case utils.MetaSuffix: fldVals = utils.SplitSuffix(fldVal) - /* - case utils.MetaExists, utils.MetaNotExists: - fldVals = []string{} // for *exists, we do not need any values, just to check if the fldName - */ + case utils.MetaExists: + fldVals = []string{utils.MetaAny} // for *exists, we will use *any value + case utils.MetaNotExists: + fldVals = []string{utils.MetaNone} // for *notexists, we will use *notexists } for _, val := range fldVals { var dbIndexes map[string]utils.StringSet // list of items matched in DB key := utils.ConcatenatedKey(filterIndexTypes[i], fldName, val) - // check filterIndexType in case of *exists or *notExistsnot - if filterIndexTypes[i] == utils.MetaExists || filterIndexTypes[i] == utils.MetaNotExists { - key = strings.TrimSuffix(key, val) // for *exists, we do not need any values, just to check if the fldName - } if dbIndexes, err = dm.GetIndexes(ctx, cacheID, itemIDPrefix, key, utils.NonTransactional, true, true); err != nil { if err == utils.ErrNotFound { err = nil diff --git a/engine/libindex.go b/engine/libindex.go index 99895402d..c80ddc1ca 100644 --- a/engine/libindex.go +++ b/engine/libindex.go @@ -118,7 +118,10 @@ func newFilterIndex(ctx *context.Context, dm *DataManager, idxItmType, tnt, grp, // this case is only for "*exists" and "*notexists" type. These 2 types does not have values, so the key will be just type and element. if len(flt.Values) == 0 { var rcvIndx map[string]utils.StringSet - idxKey := utils.ConcatenatedKey(flt.Type, flt.Element[1:], utils.EmptyString) + idxKey := utils.ConcatenatedKey(flt.Type, flt.Element[1:], utils.MetaAny) + if flt.Type == utils.MetaNotExists { + idxKey = utils.ConcatenatedKey(flt.Type, flt.Element[1:], utils.MetaNone) + } // only read from cache in case if we do not find the index to not cache the negative response if rcvIndx, err = dm.GetIndexes(ctx, idxItmType, tntGrp, idxKey, transactionID, true, false); err != nil { @@ -215,7 +218,7 @@ func updatedIndexes(ctx *context.Context, dm *DataManager, idxItmType, tnt, grp, if useGrp { itmGrp = utils.ConcatenatedKey(itemID, grp) } - if oldFilterIds == nil { // nothing to remove so just create the new indexes] + if oldFilterIds == nil { // nothing to remove so just create the new indexes if err = addIndexFiltersItem(ctx, dm, idxItmType, tnt, itmGrp, newFilterIDs); err != nil { return } @@ -424,8 +427,14 @@ func UpdateFilterIndex(ctx *context.Context, dm *DataManager, oldFlt, newFlt *Fi continue } isDyn := strings.HasPrefix(flt.Element, utils.DynamicDataPrefix) + // tthis case is specially for *exists/*notexists filter types if len(flt.Values) == 0 { - newRules.Add(utils.ConcatenatedKey(flt.Type, flt.Element[1:])) // asume it is *exists/*notexists type + switch flt.Type { + case utils.MetaExists: + newRules.Add(utils.ConcatenatedKey(flt.Type, flt.Element[1:], utils.MetaAny)) // asume it is *exists type + case utils.MetaNotExists: + newRules.Add(utils.ConcatenatedKey(flt.Type, flt.Element[1:], utils.MetaNone)) // asume it is *notexists type + } } for _, fldVal := range flt.Values { if IsDynamicDPPath(fldVal) { @@ -454,7 +463,13 @@ func UpdateFilterIndex(ctx *context.Context, dm *DataManager, oldFlt, newFlt *Fi isDyn := strings.HasPrefix(flt.Element, utils.DynamicDataPrefix) // this case is only for "*exists" and "*notexists" type. These 2 types does not have values, so the key will be just type and element. if len(flt.Values) == 0 { - idxKey := utils.ConcatenatedKey(flt.Type, flt.Element[1:], utils.EmptyString) + var idxKey string + switch flt.Type { + case utils.MetaExists: + idxKey = utils.ConcatenatedKey(flt.Type, flt.Element[1:], utils.MetaAny) // asume it is *exists type + case utils.MetaNotExists: + idxKey = utils.ConcatenatedKey(flt.Type, flt.Element[1:], utils.MetaNone) // asume it is *notexists type + } if !newRules.Has(idxKey) { removeRules.Add(idxKey) } else {