Exemplo n.º 1
0
        public void AddValue(string nameValuePair)
        {
            if (string.IsNullOrEmpty(nameValuePair))
            {
                return;
            }
            NameValueCollection keyValueCollection = NameValueCollectionTool.GetParameterKeyValueCollection(nameValuePair);

            if (keyValueCollection != null)
            {
                GroupValueDocCountList groupValueDocCountList = null;
                string[] values = null;
                foreach (string key in keyValueCollection)
                {
                    if (this._GroupKeyValueDocCountList.Contains(key))
                    {
                        groupValueDocCountList = this._GroupKeyValueDocCountList[key].GroupValueDocCountList;
                    }
                    else
                    {
                        groupValueDocCountList = new GroupValueDocCountList();
                        this._GroupKeyValueDocCountList.Add(new GroupKeyValue(key, groupValueDocCountList));
                    }
                    values = keyValueCollection[key].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (string value in values)
                    {
                        if (groupValueDocCountList.Contains(value))
                        {
                            groupValueDocCountList[value].DocCount += 1;
                        }
                        else
                        {
                            groupValueDocCountList.Add(new GroupValueDocCount(value, 1));
                        }
                    }
                    Array.Clear(values, 0, values.Length);
                    values = null;
                }
                keyValueCollection.Clear();
                keyValueCollection = null;
            }
        }
Exemplo n.º 2
0
 public GroupKeyValue(string key, GroupValueDocCountList groupValueDocCountList)
 {
     this.Key = key;
     this._GroupValueDocCountList = groupValueDocCountList;
 }