LCR subject prefix matching

fixes #388, fixes #394
This commit is contained in:
Radu Ioan Fericean
2016-04-01 13:25:54 +03:00
parent eff6f193b5
commit f49c1f694c
9 changed files with 149 additions and 107 deletions

View File

@@ -256,8 +256,9 @@ func RatingProfileSubjectPrefixMatching(key string) (rp *RatingProfile, err erro
lastIndex := strings.LastIndex(key, utils.CONCATENATED_KEY_SEP)
baseKey := key[:lastIndex]
subject := key[lastIndex:]
for i := 1; i < len(subject)-1; i++ {
if rp, err = ratingStorage.GetRatingProfile(baseKey+subject[:len(subject)-i], false); err == nil {
lenSubject := len(subject)
for i := 1; i < lenSubject-1; i++ {
if rp, err = ratingStorage.GetRatingProfile(baseKey+subject[:lenSubject-i], false); err == nil {
return rp, err
}
}