Beispiel #1
0
        private void GetCombinedKeysFromEveryType(string tag, HashVector finalResult)
        {
            if (_indexMap == null)
            {
                return;
            }
            IDictionaryEnumerator typeEnumerator;

            lock (_indexMap.SyncRoot)
            {
                typeEnumerator = _indexMap.GetEnumerator();
            }

            while (typeEnumerator.MoveNext())
            {
                AttributeIndex index = typeEnumerator.Value as AttributeIndex;
                IIndexStore    store = index.GetStore("$Tag$");

                if (store != null)
                {
                    IKeyFilter keyFilter = _cache != null?_cache.GetBucketFilter() : null;

                    IKeyFilter compoundFilter = _cache != null?_cache.GetCompoundFilter() : null;

                    IQueryResult result = new ListQueryResult(keyFilter, compoundFilter);
                    store.GetData(tag.ToLower(), ComparisonType.EQUALS, result, CollectionOperation.Union);
                    foreach (string key in result)
                    {
                        finalResult[key] = null;
                    }
                }
            }
        }
Beispiel #2
0
        private void GetCombinedKeysFromEveryType(string tag, HashVector finalResult, CancellationToken token, bool wildCardSupport = false)
        {
            if (_indexMap == null)
            {
                return;
            }
            IDictionaryEnumerator typeEnumerator;

            lock (_indexMap.SyncRoot)
            {
                typeEnumerator = _indexMap.GetEnumerator();
            }

            while (typeEnumerator.MoveNext())
            {
                if (token != null && token.IsCancellationRequested)
                {
                    throw new OperationCanceledException(ExceptionsResource.OperationFailed);
                }

                AttributeIndex index = typeEnumerator.Value as AttributeIndex;
                IIndexStore    store = index.GetStore("$Tag$");

                if (store != null)
                {
                    IKeyFilter keyFilter = _cache != null?_cache.GetBucketFilter() : null;

                    IKeyFilter compoundFilter = _cache != null?_cache.GetCompoundFilter() : null;

                    IQueryResult result = new ListQueryResult(keyFilter, compoundFilter);

                    if (wildCardSupport)
                    {
                        store.GetData(tag.ToLower(), ComparisonType.LIKE, result, CollectionOperation.Union, token);
                    }
                    else
                    {
                        store.GetData(tag.ToLower(), ComparisonType.EQUALS, result, CollectionOperation.Union, token);
                    }


                    foreach (string key in result)
                    {
                        finalResult[key] = null;
                    }
                }
            }
        }