当前位置: 首页>>代码示例>>C#>>正文


C# Lucene.Net.Index.IndexReader.GetFieldCacheKey方法代码示例

本文整理汇总了C#中Lucene.Net.Index.IndexReader.GetFieldCacheKey方法的典型用法代码示例。如果您正苦于以下问题:C# Lucene.Net.Index.IndexReader.GetFieldCacheKey方法的具体用法?C# Lucene.Net.Index.IndexReader.GetFieldCacheKey怎么用?C# Lucene.Net.Index.IndexReader.GetFieldCacheKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Lucene.Net.Index.IndexReader的用法示例。


在下文中一共展示了Lucene.Net.Index.IndexReader.GetFieldCacheKey方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Get

            public virtual System.Object Get(IndexReader reader, Entry key)
            {
                System.Collections.IDictionary innerCache;
                System.Object value_Renamed;
                System.Object readerKey = reader.GetFieldCacheKey();
                lock (readerCache.SyncRoot)
                {
                    innerCache = (System.Collections.IDictionary) readerCache[readerKey];
                    if (innerCache == null)
                    {
                        innerCache = new System.Collections.Hashtable();
                        readerCache[readerKey] = innerCache;
                        value_Renamed = null;
                    }
                    else
                    {
                        value_Renamed = innerCache[key];
                    }
                    if (value_Renamed == null)
                    {
                        value_Renamed = new CreationPlaceholder();
                        innerCache[key] = value_Renamed;
                    }
                }
                if (value_Renamed is CreationPlaceholder)
                {
                    lock (value_Renamed)
                    {
                        CreationPlaceholder progress = (CreationPlaceholder) value_Renamed;
                        if (progress.value_Renamed == null)
                        {
                            progress.value_Renamed = CreateValue(reader, key);
                            lock (readerCache.SyncRoot)
                            {
                                innerCache[key] = progress.value_Renamed;
                            }

                            // Only check if key.custom (the parser) is
                            // non-null; else, we check twice for a single
                            // call to FieldCache.getXXX
                            if (key.custom != null && wrapper != null)
                            {
                                System.IO.StreamWriter infoStream = wrapper.GetInfoStream();
                                if (infoStream != null)
                                {
                                    PrintNewInsanity(infoStream, progress.value_Renamed);
                                }
                            }
                        }
                        return progress.value_Renamed;
                    }
                }
                return value_Renamed;
            }
开发者ID:andylaudotnet,项目名称:StockFoo,代码行数:54,代码来源:FieldCacheImpl.cs

示例2: GetCachedResult

		private SpanFilterResult GetCachedResult(IndexReader reader)
		{
            object coreKey = reader.GetFieldCacheKey();
            object delCoreKey = reader.HasDeletions() ? reader.GetDeletesCacheKey() : coreKey;

            SpanFilterResult result = (SpanFilterResult) cache.Get(reader, coreKey, delCoreKey);
            if (result != null) {
                hitCount++;
                return result;
            }

            missCount++;
            result = filter.BitSpans(reader);

            cache.Put(coreKey, delCoreKey, result);
            return result;
		}
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:17,代码来源:CachingSpanFilter.cs

示例3: GetDocIdSet

		public override DocIdSet GetDocIdSet(IndexReader reader)
		{
			object coreKey = reader.GetFieldCacheKey();
            object delCoreKey = reader.HasDeletions() ? reader.GetDeletesCacheKey() : coreKey;

            object cached = cache.Get(reader, coreKey, delCoreKey);
			
			if (cached != null)
			{
                hitCount++;
				if (cached is DocIdSet)
					return (DocIdSet) cached;
				else
					return new DocIdBitSet((System.Collections.BitArray) cached);
			}
            missCount++;
            // cache miss
			DocIdSet docIdSet = DocIdSetToCache(filter.GetDocIdSet(reader), reader);
			
			if (docIdSet != null)
			{
                cache.Put(coreKey, delCoreKey, docIdSet);
			}
			
			return docIdSet;
		}
开发者ID:Mpdreamz,项目名称:lucene.net,代码行数:26,代码来源:CachingWrapperFilter.cs

示例4: Purge

 /** Remove this reader from the cache, if present. */
 public void Purge(IndexReader r)
 {
     object readerKey = r.GetFieldCacheKey();
     lock (readerCache)
     {
         readerCache.Remove(readerKey);
     }
 }
开发者ID:Mpdreamz,项目名称:lucene.net,代码行数:9,代码来源:FieldCacheImpl.cs

示例5: Bits

		public override System.Collections.BitArray Bits(IndexReader reader)
		{
			object coreKey = reader.GetFieldCacheKey();
            object delCoreKey = reader.HasDeletions() ? reader.GetDeletesCacheKey() : coreKey;

            object cached = cache.Get(reader, coreKey, delCoreKey);
			
			if (cached != null)
			{
				if (cached is System.Collections.BitArray)
				{
					return (System.Collections.BitArray) cached;
				}
				else if (cached is DocIdBitSet)
					return ((DocIdBitSet) cached).GetBitSet();
				// It would be nice to handle the DocIdSet case, but that's not really possible
			}
			
			System.Collections.BitArray bits = filter.Bits(reader);

            if (bits != null)
            {
                cache.Put(coreKey, delCoreKey, bits);
            }
			
			return bits;
		}
开发者ID:Mpdreamz,项目名称:lucene.net,代码行数:27,代码来源:CachingWrapperFilter.cs


注:本文中的Lucene.Net.Index.IndexReader.GetFieldCacheKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。