예제 #1
0
        public IIndexStore GetStore(string attrib)
        {
            bool        disacleException = QueryIndexManager.DisableException;
            IIndexStore store            = null;

            lock (_mutex)
            {
                if (_indexTable.Contains(attrib))
                {
                    store = _indexTable[attrib] as IIndexStore;
                }
                else
                {
                    if (disacleException)
                    {
                        if (store == null)
                        {
                            store = new HashStore();
                        }
                    }
                }
            }

            return(store);
        }
예제 #2
0
        public virtual void AddToIndex(object key, object value)
        {
            lock (_mutex)
            {
                IDictionaryEnumerator valuesDic = ((Hashtable)value).GetEnumerator();

                while (valuesDic.MoveNext())
                {
                    string      indexKey = (string)valuesDic.Key;
                    IIndexStore store    = _indexTable[indexKey] as IIndexStore;

                    if (store == null && indexKey == TAG_INDEX_KEY)
                    {
                        store = new HashStore();
                        _indexTable[indexKey] = store;
                    }

                    if (store != null)
                    {
                        object val = valuesDic.Value;

                        if (val != null)
                        {
                            store.Add(val, key);
                        }
                        else
                        {
                            store.Add("null", key);
                        }
                    }
                }
            }
        }
예제 #3
0
        public IIndexStore GetStore(string attrib)
        {
            bool        disacleException = QueryIndexManager.DisableException;
            IIndexStore store            = null;

            if (IndexTable.Contains(attrib))
            {
                store = IndexTable[attrib] as IIndexStore;
            }
            else
            {
                string namedTagKey = ConvertToNamedTagKey(attrib);

                if (IndexTable.Contains(namedTagKey))
                {
                    store = IndexTable[namedTagKey] as IIndexStore;
                }

                if (disacleException)
                {
                    if (store == null)
                    {
                        store = new HashStore();
                    }
                }
            }

            return(store);
        }
예제 #4
0
        private void Initialize()
        {
            _indexTable = new HashVector();
            IIndexStore store = new HashStore();

            _indexTable[TAG_INDEX_KEY] = store;
        }
        public override void AddToIndex(object key, object value)
        {
            lock (_mutex)
            {
                Hashtable             attributeValues = value as Hashtable;
                IDictionaryEnumerator valuesDic       = attributeValues.GetEnumerator();

                while (valuesDic.MoveNext())
                {
                    string      indexKey = (string)valuesDic.Key;
                    IIndexStore store    = IndexTable[indexKey] as IIndexStore;

                    if (store == null)
                    {
                        if (indexKey == TAG_INDEX_KEY)
                        {
                            store = new HashStore();
                            IndexTable[indexKey] = store;
                        }
                        else
                        {
                            string namedTagIndexKey = ConvertToNamedTagKey(indexKey);
                            store = IndexTable[namedTagIndexKey] as IIndexStore;

                            if (store == null)
                            {
                                store = new HashStore();
                                IndexTable[namedTagIndexKey] = store;
                            }
                        }
                    }

                    if (store != null)
                    {
                        object val = valuesDic.Value;

                        if (val != null)
                        {
                            store.Add(val, key);
                        }
                        else
                        {
                            store.Add("null", key);
                        }
                    }
                }
            }
        }
        public override void Initialize(ArrayList attribList)
        {
            IIndexStore store = null;

            if (attribList != null && attribList.Count > 0)
            {
                IEnumerator e = attribList.GetEnumerator();

                while (e.MoveNext())
                {
                    string attribName = e.Current.ToString();
                    if (commonRbStores != null && commonRbStores.ContainsKey(_type + ":" + attribName))
                    {
                        HashStore commonStore = (HashStore)commonRbStores[_type + ":" + attribName];
                        IndexTable.Add(attribName, commonStore);
                    }
                    else
                    {
                        store = new HashStore();
                        IndexTable.Add(attribName, store);
                    }
                }
                if (commonRbStores != null && commonRbStores.ContainsKey(TAG_INDEX_KEY))
                {
                    store = (HashStore)commonRbStores[TAG_INDEX_KEY];
                    IndexTable.Add(TAG_INDEX_KEY, store);
                }
                else
                {
                    store = new HashStore();
                    IndexTable.Add(TAG_INDEX_KEY, store);
                }
            }

            if (!IndexTable.ContainsKey(TAG_INDEX_KEY) && commonRbStores != null && commonRbStores.ContainsKey(TAG_INDEX_KEY))
            {
                store = (HashStore)commonRbStores[TAG_INDEX_KEY];
                IndexTable.Add(TAG_INDEX_KEY, store);
            }
        }
        public override void RemoveFromIndex(object key, object value)
        {
            lock (_mutex)
            {
                Hashtable             attributeValues = value as Hashtable;
                IDictionaryEnumerator valuesDic       = attributeValues.GetEnumerator();

                while (valuesDic.MoveNext())
                {
                    string indexKey = (string)valuesDic.Key;

                    if (IndexTable.Contains(indexKey) || IndexTable.Contains(indexKey = ConvertToNamedTagKey(indexKey)))
                    {
                        IIndexStore store = IndexTable[indexKey] as IIndexStore;
                        object      val   = valuesDic.Value;

                        if (val != null)
                        {
                            store.Remove(val, key);
                        }
                        else
                        {
                            store.Remove("null", key);
                        }

                        if (store.Count == 0)
                        {
                            if (indexKey == TAG_INDEX_KEY || IsNamedTagKey(indexKey))
                            {
                                IndexTable.Remove(indexKey);
                            }
                            else
                            {
                                IndexTable[indexKey] = new HashStore();
                            }
                        }
                    }
                }
            }
        }
예제 #8
0
        public IIndexStore GetStore(string attrib)
        {
            bool disacleException = QueryIndexManager.DisableException;
            IIndexStore store = null;

            if (_indexTable.Contains(attrib))
                store = _indexTable[attrib] as IIndexStore;
            else
            {
                if (disacleException)
                {
                    if (store == null)
                    {
                        store = new HashStore();
                    }
                }
            }

            return store;
        }