/// <summary> /// Recupera a combinação das chaves de qualquer tipo. /// </summary> /// <param name="tag"></param> /// <returns></returns> private ArrayList GetCombinedKeysFromEveryType(string tag) { if (base.IndexMapInternal == null) { return(null); } ArrayList data = null; Hashtable hashtable = new Hashtable(); IDictionaryEnumerator enumerator = base.IndexMapInternal.GetEnumerator(); while (enumerator.MoveNext()) { IIndexStore store = (enumerator.Value as AttributeIndex).GetStore("$Tag$"); if (store != null) { data = store.GetData(tag.ToLower(), ComparisonType.EQUALS); if ((data != null) && (data.Count > 0)) { for (int i = 0; i < data.Count; i++) { hashtable[data[i]] = null; } } } } return(new ArrayList(hashtable.Keys)); }
public void Add(string storeName, IIndexStore store, INodeReference node) { IndexStoreInformation ni = new IndexStoreInformation(storeName, store, node); if (_nodeInfo == null) { _nodeInfo = ni; _nodeInfoMaxCount = _nodeInfoMaxCount < 1 ? (ushort)1 : _nodeInfoMaxCount; } else { if (_nodeInfo is IndexStoreInformation) { ClusteredList <IndexStoreInformation> _list = new ClusteredList <IndexStoreInformation>(); _list.Add((IndexStoreInformation)_nodeInfo); _list.Add(ni); _nodeInfo = _list; if (_list.Count > _nodeInfoMaxCount) { _nodeInfoMaxCount = (ushort)_list.Count; } } else { ClusteredList <IndexStoreInformation> _list = ((ClusteredList <IndexStoreInformation>)_nodeInfo); _list.Add(ni); if (_list.Count > _nodeInfoMaxCount) { _nodeInfoMaxCount = (ushort)_list.Count; } } } _indexInformationSize += (ushort)ni.IndexInMemorySize; }
public virtual void RemoveFromIndex(object key, object value) { lock (_mutex) { IDictionaryEnumerator valuesDic = ((Hashtable)value).GetEnumerator(); while (valuesDic.MoveNext()) { string indexKey = (string)valuesDic.Key; if (_indexTable.Contains(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 && indexKey == TAG_INDEX_KEY) { _indexTable.Remove(indexKey); } } } } }
internal override void ExecuteInternal(QueryContext queryContext, ref SortedList list) { AttributeIndex index = queryContext.Index; IIndexStore store = ((MemberFunction)functor).GetStore(index); if (store != null) { ArrayList keyList = null; if (Inverse) { keyList = store.GetData(generator.Evaluate(((MemberFunction)functor).MemberName, queryContext.AttributeValues), ComparisonType.LESS_THAN_EQUALS); } else { keyList = store.GetData(generator.Evaluate(((MemberFunction)functor).MemberName, queryContext.AttributeValues), ComparisonType.GREATER_THAN); } if (keyList != null) { list.Add(keyList.Count, keyList); } } else { throw new AttributeIndexNotDefined("Index is not defined for attribute '" + ((MemberFunction)functor).MemberName + "'"); } }
public virtual void RemoveFromIndex(object key, object value) { lock (_mutex) { bool isNodeRemoved = false; CacheEntry entry = (CacheEntry)value; IndexInformation indexInfo = entry.IndexInfo; if (indexInfo != null) { foreach (IndexStoreInformation indexStoreInfo in indexInfo.IndexStoreInformations) { isNodeRemoved = false; IIndexStore store = indexStoreInfo.Store; if (indexStoreInfo.IndexPosition != null) { long prevSize = store.IndexInMemorySize; isNodeRemoved = store.Remove(key, indexStoreInfo.IndexPosition); _attributeIndexSize += store.IndexInMemorySize - prevSize; } } _keyIndexInformationSize -= indexInfo.IndexInMemorySize; } entry.IndexInfo = null; } }
internal override void ExecuteInternal(QueryContext queryContext, ref SortedList list) { ArrayList keyList = null; pattern = (string)generator.Evaluate(((MemberFunction)functor).MemberName, queryContext.AttributeValues); pattern = pattern.Trim('\''); AttributeIndex index = queryContext.Index; IIndexStore store = ((MemberFunction)functor).GetStore(index); if (store != null) { if (Inverse) { keyList = store.GetData(pattern, ComparisonType.NOT_LIKE); } else { keyList = store.GetData(pattern, ComparisonType.LIKE); } if (keyList != null) { list.Add(keyList.Count, keyList); } } else { throw new AttributeIndexNotDefined("Index is not defined for attribute '" + ((MemberFunction)functor).MemberName + "'"); } }
public virtual void RemoveFromIndex(object key, object value) { lock (_mutex) { CacheEntry entry = (CacheEntry)value; IndexInformation indexInfo = entry.IndexInfo; if (indexInfo != null && indexInfo.IndexStoreInformations != null) { foreach (IndexStoreInformation indexStoreInfo in indexInfo.IndexStoreInformations) { IIndexStore store = indexStoreInfo.Store; if (indexStoreInfo.IndexPosition != null) { long prevSize = store.IndexInMemorySize; store.Remove(key, indexStoreInfo.IndexPosition); _attributeIndexSize += store.IndexInMemorySize - prevSize; string possibleNamedTagKey = ConvertToNamedTagKey(store.Name); if (store.Count == 0 && IndexTable.ContainsKey(possibleNamedTagKey)) { IndexTable.Remove(possibleNamedTagKey); } } } _keyIndexInformationSize -= indexInfo.IndexInMemorySize; } entry.IndexInfo = null; } }
public IndexService(IFhirModel fhirModel, ResourceVisitor resourceVisitor, ElementIndexer elementIndexer, IIndexStore indexStore) { _fhirModel = fhirModel; _resourceVisitor = resourceVisitor; _elementIndexer = elementIndexer; _indexStore = indexStore; }
public IndexBuilder(IIndexStore indexContext, IDbContext primaryContext, IIndexQueue queue, IIndexRegister registry) { _indexContext = indexContext; _primaryContext = primaryContext; _indexQueue = queue; _registry = registry; }
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); }
public void Add(string storeName, IIndexStore store, INodeReference node) { IndexStoreInformation ni = new IndexStoreInformation(storeName, store, node); if (_nodeInfo == null) { _nodeInfo = ni; _nodeInfoMaxCount = _nodeInfoMaxCount < 1 ? (ushort)1 : _nodeInfoMaxCount; } else { if (_nodeInfo is IndexStoreInformation) { ClusteredList<IndexStoreInformation> _list = new ClusteredList<IndexStoreInformation>(); _list.Add((IndexStoreInformation)_nodeInfo); _list.Add(ni); _nodeInfo = _list; if (_list.Count > _nodeInfoMaxCount) _nodeInfoMaxCount = (ushort)_list.Count; } else { ClusteredList<IndexStoreInformation> _list = ((ClusteredList<IndexStoreInformation>)_nodeInfo); _list.Add(ni); if (_list.Count > _nodeInfoMaxCount) _nodeInfoMaxCount = (ushort)_list.Count; } } _indexInformationSize += (ushort)ni.IndexInMemorySize; }
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); } } } } }
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); }
public IDictionaryEnumerator GetEnumerator(string type, bool forTag) { lock (_mutex) { IDictionaryEnumerator en = IndexTable.GetEnumerator(); if (!forTag) { while (en.MoveNext()) { IIndexStore store = en.Value as IIndexStore; if ((string)en.Key != TAG_INDEX_KEY) { if (store != null) { return(store.GetEnumerator()); } } } } else { if (IndexTable.Contains(TAG_INDEX_KEY)) { IIndexStore store = IndexTable[TAG_INDEX_KEY] as IIndexStore; if (store != null) { return(store.GetEnumerator()); } } } } return(null); }
/// <summary> /// Remove a chave e o valor do indice. /// </summary> /// <param name="key"></param> /// <param name="value"></param> public virtual void RemoveFromIndex(object key, object value) { IDictionaryEnumerator enumerator = (value as Hashtable).GetEnumerator(); while (enumerator.MoveNext()) { string str = (string)enumerator.Key; if (_indexTable.Contains(str) || _indexTable.Contains(str = ConvertToNamedTagKey(str))) { IIndexStore store = _indexTable[str] as IIndexStore; object obj2 = enumerator.Value; if (obj2 != null) { store.Remove(obj2, key); } else { store.Remove(CacheNull.Value, key); } if (store.Size == 0) { if ((str == "$Tag$") || IsNamedTagKey(str)) { _indexTable.Remove(str); } else { _indexTable[str] = CreateIndexStore(); } } } } }
public virtual void RemoveFromIndex(object key, object value) { Hashtable attributeValues = value as Hashtable; IDictionaryEnumerator valuesDic = attributeValues.GetEnumerator(); while (valuesDic.MoveNext()) { string indexKey = (string)valuesDic.Key; if (_indexTable.Contains(indexKey)) { IIndexStore store = _indexTable[indexKey] as IIndexStore; object val = valuesDic.Value; long prev = store.IndexInMemorySize; if (val != null) { store.Remove(val, key); } else { store.Remove("null", key); } if (store.Count == 0) { String storeDataType = ((RBStore)store).StoreDataType; _indexTable[indexKey] = new RBStore(_cacheName, storeDataType); } _attributeIndexSize += store.IndexInMemorySize - prev; } } }
internal override void Execute(QueryContext queryContext, Predicate nextPredicate) { AttributeIndex index = queryContext.Index; IIndexStore store = ((MemberFunction)functor).GetStore(index); if (store != null) { ClusteredArrayList keyList = null; if (Inverse) { store.GetData( generator.Evaluate(((MemberFunction)functor).MemberName, queryContext.AttributeValues), ComparisonType.LESS_THAN_EQUALS, queryContext.InternalQueryResult, CollectionOperation.Union); } else { store.GetData( generator.Evaluate(((MemberFunction)functor).MemberName, queryContext.AttributeValues), ComparisonType.GREATER_THAN, queryContext.InternalQueryResult, CollectionOperation.Union); } } else { throw new AttributeIndexNotDefined("Index is not defined for attribute '" + ((MemberFunction)functor).MemberName + "'"); } }
/// <summary> /// See attribute-level indexes can't be used in this predicate. /// </summary> /// <param name="queryContext"></param> internal override void Execute(QueryContext queryContext, Predicate nextPredicate) { ClusteredArrayList keyList = null; pattern = (string)generator.Evaluate(((MemberFunction)functor).MemberName, queryContext.AttributeValues); pattern = pattern.Trim('\''); AttributeIndex index = queryContext.Index; IIndexStore store = ((MemberFunction)functor).GetStore(index); if (store != null) { if (Inverse) { store.GetData(pattern, ComparisonType.NOT_LIKE, queryContext.InternalQueryResult, CollectionOperation.Union, queryContext.CancellationToken); } else { store.GetData(pattern, ComparisonType.LIKE, queryContext.InternalQueryResult, CollectionOperation.Union, queryContext.CancellationToken); } } else { throw new AttributeIndexNotDefined("Index is not defined for attribute '" + ((MemberFunction)functor).MemberName + "'"); } }
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; } } } }
public IndexService(IFhirModel fhirModel, FhirPropertyIndex propIndex, ResourceVisitor resourceVisitor, ElementIndexer elementIndexer, IIndexStore indexStore) { _fhirModel = fhirModel; _propIndex = propIndex; _resourceVisitor = resourceVisitor; _elementIndexer = elementIndexer; _indexStore = indexStore; }
public IndexWorker(ILogger <IndexWorker> logger, ServiceConfig config, IWorkQueue <IndexRequest> queue, IClientFactory clientFactory, IIndexStore indexStore, RegistryAuthenticationDecoder authDecoder, IAuthHandler authHandler, ICacheFactory cacheFactory) : base(logger, config, queue, clientFactory) { this.indexStore = indexStore; this.authDecoder = authDecoder; this.authHandler = authHandler; this.cacheFactory = cacheFactory; }
public IndexService(IFhirModel fhirModel, FhirPropertyIndex propIndex, ResourceVisitor resourceVisitor, ElementIndexer elementIndexer, IIndexStore indexStore) { _fhirModel = fhirModel; _propIndex = propIndex; _resourceVisitor = resourceVisitor; _elementIndexer = elementIndexer; _indexStore = indexStore; }
public RepositoryController(ILoggerFactory logFactory, IAuthHandler auth, IClientFactory clientFactory, IIndexStore indexStore, IWorkQueue <IndexRequest> indexQueue, ISecurityScanner secScanner = null) : base(logFactory, auth) { this.clientFactory = clientFactory; this.logger = logFactory.CreateLogger <RepositoryController>(); this.indexStore = indexStore; this.indexQueue = indexQueue; this.secScanner = secScanner; }
/// <summary> /// Initializes a new instance of the <see cref="MetadataProviderBase"/> class. /// </summary> public MetadataProviderBase(string projectId, string connectionString, IBinaryProvider binaryProvider, Dictionary <string, IBinaryProvider> supportedBinaryProviders, IIndexStore indexStore, IAuditReportProvider auditReportProvider) { ProjectId = projectId; ConnectionString = connectionString; IndexStore = indexStore; AuditReportProvider = auditReportProvider; BinaryProvider = binaryProvider; SupportedBinaryProviders = supportedBinaryProviders; }
public IDictionaryEnumerator GetEnumerator(string typeName, bool forTag) { if (_indexTable.Contains(TAG_INDEX_KEY)) { IIndexStore store = _indexTable[TAG_INDEX_KEY] as IIndexStore; return(store.GetEnumerator()); } return(null); }
public IndexRebuildService( IIndexStore indexStore, IIndexService indexService, IFhirStorePagedReader entryReader, SparkSettings sparkSettings) { _indexStore = indexStore ?? throw new ArgumentNullException(nameof(indexStore)); _indexService = indexService ?? throw new ArgumentNullException(nameof(indexService)); _entryReader = entryReader ?? throw new ArgumentNullException(nameof(entryReader)); _sparkSettings = sparkSettings ?? throw new ArgumentNullException(nameof(sparkSettings)); }
public void Add(string storeName,IIndexStore store, RedBlackNodeReference node) { IndexStoreInformation ni = new IndexStoreInformation(storeName, store, node); _nodeInfo.Add(ni); if (_nodeInfo.Count > _nodeInfoMaxCount) _nodeInfoMaxCount = _nodeInfo.Count; _indexInformationSize += (int)ni.IndexInMemorySize; }
public void Clear() { lock (_mutex) { IDictionaryEnumerator e = _indexTable.GetEnumerator(); while (e.MoveNext()) { IIndexStore index = e.Value as IIndexStore; index.Clear(); } } }
public void Clear() { IDictionaryEnumerator e = _indexTable.GetEnumerator(); while (e.MoveNext()) { IIndexStore store = e.Value as IIndexStore; store.Clear(); } _attributeIndexSize = 0; }
internal override void ExecuteInternal(QueryContext queryContext, CollectionOperation mergeType) { AttributeIndex index = queryContext.Index; IIndexStore store = ((MemberFunction)functor).GetStore(index); if (store != null) { members = queryContext.AttributeValues[((MemberFunction)functor).MemberName] as ArrayList; if (members == null) { if (queryContext.AttributeValues.Count > 0) { members = new ArrayList(); members.Add(queryContext.AttributeValues[((MemberFunction)functor).MemberName]); } else { throw new Exception("Value(s) not specified for indexed attribute " + ((MemberFunction)functor).MemberName + "."); } } IQueryResult tempResult = queryContext.InternalQueryResult; queryContext.InternalQueryResult = new Common.Queries.HashedQueryResult(); if (!Inverse) { for (int i = 0; i < members.Count; i++) { store.GetData(members[i], ComparisonType.EQUALS, queryContext.InternalQueryResult, CollectionOperation.Union); } } else { store.GetData(members[0], ComparisonType.NOT_EQUALS, queryContext.InternalQueryResult, CollectionOperation.Union); if (queryContext.InternalQueryResult != null) { if (queryContext.InternalQueryResult.Count > 0) { for (int i = 1; i < members.Count; i++) { store.GetData(members[i], ComparisonType.EQUALS, queryContext.InternalQueryResult, CollectionOperation.Subtract); } } } } queryContext.InternalQueryResult.Merge(tempResult, mergeType); } else { throw new AttributeIndexNotDefined("Index is not defined for attribute '" + ((MemberFunction)functor).MemberName + "'"); } }
public void Add(string storeName, IIndexStore store, RedBlackNodeReference node) { IndexStoreInformation ni = new IndexStoreInformation(storeName, store, node); _nodeInfo.Add(ni); if (_nodeInfo.Count > _nodeInfoMaxCount) { _nodeInfoMaxCount = _nodeInfo.Count; } _indexInformationSize += (int)ni.IndexInMemorySize; }
public IDictionaryEnumerator GetEnumerator(string type) { IDictionaryEnumerator en = _indexTable.GetEnumerator(); while (en.MoveNext()) { IIndexStore store = en.Value as IIndexStore; return(store.GetEnumerator()); } return(null); }
public virtual void AddToIndex(object key, object value) { lock (_mutex) { QueryItemContainer container = (QueryItemContainer)value; CacheEntry entry = container.Item; Hashtable attributeValues = container.ItemArrtributes; IDictionaryEnumerator valuesDic = attributeValues.GetEnumerator(); INodeReference keyNode = null; while (valuesDic.MoveNext()) { string indexKey = (string)valuesDic.Key; string storeName = indexKey; IIndexStore store = _indexTable[indexKey] as IIndexStore; keyNode = null; if (store != null) { long prev = store.IndexInMemorySize; object val = valuesDic.Value; if (val != null) { keyNode = (INodeReference)store.Add(val, key); } _attributeIndexSize += store.IndexInMemorySize - prev; } storeName = Common.Util.StringPool.PoolString(storeName); IndexInformation info; if (entry.IndexInfo != null) { info = entry.IndexInfo; } else { info = new IndexInformation(); } long prevSize = info.IndexInMemorySize; info.Add(storeName, store, keyNode); this._keyIndexInformationSize += info.IndexInMemorySize - prevSize; entry.IndexInfo = info; } } }
public IndexStoreInformation(string storeName,IIndexStore store, RedBlackNodeReference node) { _rbnodes = node; _store = store; _storeName = storeName; }
/// <summary> /// Creates a new Engine for indexing and searching documents /// </summary> /// <param name="options"> /// An instance of EngineOptions containing the settings for /// the search engine /// </param> /// <param name="storageProvider"> /// A implementation of the index store interface /// that the engine will use to store its index /// </param> public Engine(EngineOptions options, IIndexStore storageProvider) { _options = options; _store = storageProvider; _nonAlphaNumChars = new Regex("[^a-zA-Z0-9]", RegexOptions.Compiled); }