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


C# Index.IndexReader类代码示例

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


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

示例1: SetUp

		public override void  SetUp()
		{
			base.SetUp();
			RAMDirectory directory = new RAMDirectory();
			IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
			long theLong = System.Int64.MaxValue;
			double theDouble = System.Double.MaxValue;
			sbyte theByte = (sbyte) System.SByte.MaxValue;
			short theShort = System.Int16.MaxValue;
			int theInt = System.Int32.MaxValue;
			float theFloat = System.Single.MaxValue;
			for (int i = 0; i < NUM_DOCS; i++)
			{
				Document doc = new Document();
				doc.Add(new Field("theLong", System.Convert.ToString(theLong--), Field.Store.NO, Field.Index.NOT_ANALYZED));
				doc.Add(new Field("theDouble", (theDouble--).ToString("E16"), Field.Store.NO, Field.Index.NOT_ANALYZED));
				doc.Add(new Field("theByte", System.Convert.ToString((sbyte) theByte--), Field.Store.NO, Field.Index.NOT_ANALYZED));
				doc.Add(new Field("theShort", System.Convert.ToString(theShort--), Field.Store.NO, Field.Index.NOT_ANALYZED));
				doc.Add(new Field("theInt", System.Convert.ToString(theInt--), Field.Store.NO, Field.Index.NOT_ANALYZED));
				doc.Add(new Field("theFloat", (theFloat--).ToString("E8"), Field.Store.NO, Field.Index.NOT_ANALYZED));
				writer.AddDocument(doc);
			}
			writer.Close();
			reader = IndexReader.Open(directory);
		}
开发者ID:Rationalle,项目名称:ravendb,代码行数:25,代码来源:TestFieldCache.cs

示例2: Bits

			public override System.Collections.BitArray Bits(IndexReader reader)
			{
				System.Collections.BitArray bitset = new System.Collections.BitArray((5 % 64 == 0?5 / 64:5 / 64 + 1) * 64);
				bitset.Set(1, true);
				bitset.Set(3, true);
				return bitset;
			}
开发者ID:runefs,项目名称:Marvin,代码行数:7,代码来源:TestFilteredQuery.cs

示例3: GetDocIdSet

			public override DocIdSet GetDocIdSet(IndexReader reader)
			{
				System.Collections.BitArray bitset = new System.Collections.BitArray((5 % 64 == 0?5 / 64:5 / 64 + 1) * 64);
				bitset.Set(1, true);
				bitset.Set(3, true);
				return new DocIdBitSet(bitset);
			}
开发者ID:Rationalle,项目名称:ravendb,代码行数:7,代码来源:TestFilteredQuery.cs

示例4: GetDocIdSet

		public override DocIdSet GetDocIdSet(IndexReader reader)
		{
			if (cache == null)
			{
				cache = new System.Collections.Hashtable();
			}
			
			lock (cache.SyncRoot)
			{
				// check cache
				DocIdSet cached = (DocIdSet) cache[reader];
				if (shouldHaveCache)
				{
					Assert.IsNotNull(cached, "Cache should have data ");
				}
				else
				{
					Assert.IsNotNull( cached, "Cache should be null " + cached);
				}
				if (cached != null)
				{
					return cached;
				}
			}
			
			DocIdSet bits = filter.GetDocIdSet(reader);
			
			lock (cache.SyncRoot)
			{
				// update cache
				cache[reader] = bits;
			}
			
			return bits;
		}
开发者ID:Rationalle,项目名称:ravendb,代码行数:35,代码来源:CachingWrapperFilterHelper.cs

示例5: SubReader

		/// <summary> Returns sub-reader subIndex from reader.
		/// 
		/// </summary>
		/// <param name="reader">parent reader
		/// </param>
		/// <param name="subIndex">index of desired sub reader
		/// </param>
		/// <returns> the subreader at subINdex
		/// </returns>
		public static IndexReader SubReader(IndexReader reader, int subIndex)
		{
            var subReadersList = new System.Collections.Generic.List<IndexReader>();
			ReaderUtil.GatherSubReaders(subReadersList, reader);
			IndexReader[] subReaders = subReadersList.ToArray();
			return subReaders[subIndex];
		}
开发者ID:modulexcite,项目名称:Xamarin-Lucene.Net,代码行数:16,代码来源:ReaderUtil.cs

示例6: Rewrite

		public override Query Rewrite(IndexReader reader)
		{
			Query orig = new RegexQuery(term).Rewrite(reader);
			
			// RegexQuery (via MultiTermQuery).rewrite always returns a BooleanQuery
			BooleanQuery bq = (BooleanQuery) orig;
			
			BooleanClause[] clauses = bq.GetClauses();
			SpanQuery[] sqs = new SpanQuery[clauses.Length];
			for (int i = 0; i < clauses.Length; i++)
			{
				BooleanClause clause = clauses[i];
				
				// Clauses from RegexQuery.rewrite are always TermQuery's
				TermQuery tq = (TermQuery) clause.GetQuery();
				
				sqs[i] = new SpanTermQuery(tq.GetTerm());
				sqs[i].SetBoost(tq.GetBoost());
			}
			
			SpanOrQuery query = new SpanOrQuery(sqs);
			query.SetBoost(orig.GetBoost());
			
			return query;
		}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:25,代码来源:SpanRegexQuery.cs

示例7: Rewrite

		public override Query Rewrite(IndexReader reader)
		{
			if (!termContainsWildcard)
				return new TermQuery(GetTerm());
			else
				return base.Rewrite(reader);
		}
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:7,代码来源:WildcardQuery.cs

示例8: Bits

        public override System.Collections.BitArray Bits(IndexReader reader)
        {
            if (cache == null)
            {
                cache = new System.Collections.Hashtable();
            }

            lock (cache.SyncRoot)
            {
                // check cache
                System.Collections.BitArray cached = (System.Collections.BitArray) cache[reader];
                if (cached != null)
                {
                    return cached;
                }
            }

            System.Collections.BitArray bits = new System.Collections.BitArray((reader.MaxDoc() % 64 == 0?reader.MaxDoc() / 64:reader.MaxDoc() / 64 + 1) * 64);

            new IndexSearcher(reader).Search(query, new AnonymousClassHitCollector(bits, this));

            lock (cache.SyncRoot)
            {
                // update cache
                cache[reader] = bits;
            }

            return bits;
        }
开发者ID:karino2,项目名称:wikipediaconv,代码行数:29,代码来源:QueryFilter.cs

示例9: Rewrite

 public override Query Rewrite(IndexReader reader)
 {
     BooleanQuery query = new BooleanQuery(true);
     TermEnum enumerator = reader.Terms(prefix);
     try
     {
         System.String prefixText = prefix.Text();
         System.String prefixField = prefix.Field();
         do
         {
             Term term = enumerator.Term();
             if (term != null && term.Text().StartsWith(prefixText) && term.Field() == prefixField)
             {
                 TermQuery tq = new TermQuery(term); // found a match
                 tq.SetBoost(GetBoost()); // set the boost
                 query.Add(tq, BooleanClause.Occur.SHOULD); // add to query
                 //System.out.println("added " + term);
             }
             else
             {
                 break;
             }
         }
         while (enumerator.Next());
     }
     finally
     {
         enumerator.Close();
     }
     return query;
 }
开发者ID:kiichi7,项目名称:Search-Engine,代码行数:31,代码来源:PrefixQuery.cs

示例10: Bits

		public override System.Collections.BitArray Bits(IndexReader reader)
		{
			System.Collections.BitArray bits = new System.Collections.BitArray((reader.MaxDoc() % 64 == 0 ? reader.MaxDoc() / 64 : reader.MaxDoc() / 64 + 1) * 64);
			
			new IndexSearcher(reader).Search(query, new AnonymousClassHitCollector(bits, this));
			return bits;
		}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:7,代码来源:QueryWrapperFilter.cs

示例11: Purge

 public void Purge(IndexReader r)
 {
     foreach (Cache c in caches.Values)
     {
         c.Purge(r);
     }
 }
开发者ID:Mpdreamz,项目名称:lucene.net,代码行数:7,代码来源:FieldCacheImpl.cs

示例12: NewComparator

		// inherit javadocs
		public virtual ScoreDocComparator NewComparator(IndexReader reader, System.String fieldname)
		{
			System.String field = String.Intern(fieldname);
			System.IComparable[] cachedValues = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetCustom(reader, field, this);
			
			return new AnonymousClassScoreDocComparator(cachedValues, this);
		}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:8,代码来源:SortComparator.cs

示例13: SetUp

		public override void  SetUp()
		{
			base.SetUp();
			PayloadHelper helper = new PayloadHelper();
			searcher = helper.SetUp(similarity, 1000);
			indexReader = searcher.GetIndexReader();
		}
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:7,代码来源:TestPayloadSpans.cs

示例14: CreateValue

			protected internal override System.Object CreateValue(IndexReader reader, System.Object entryKey)
			{
				Entry entry = (Entry) entryKey;
				System.String field = entry.field;
				LongParser parser = (LongParser) entry.custom;
				long[] retArray = new long[reader.MaxDoc()];
				TermDocs termDocs = reader.TermDocs();
				TermEnum termEnum = reader.Terms(new Term(field, ""));
				try
				{
					do 
					{
						Term term = termEnum.Term();
						if (term == null || (System.Object) term.Field() != (System.Object) field)
							break;
						long termval = parser.ParseLong(term.Text());
						termDocs.Seek(termEnum);
						while (termDocs.Next())
						{
							retArray[termDocs.Doc()] = termval;
						}
					}
					while (termEnum.Next());
				}
				finally
				{
					termDocs.Close();
					termEnum.Close();
				}
				return retArray;
			}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:31,代码来源:ExtendedFieldCacheImpl.cs

示例15: MatchAllScorer

			internal MatchAllScorer(MatchAllDocsQuery enclosingInstance, IndexReader reader, Similarity similarity, Weight w, byte[] norms):base(similarity)
			{
				InitBlock(enclosingInstance);
				this.termDocs = reader.TermDocs(null);
				score = w.GetValue();
				this.norms = norms;
			}
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:7,代码来源:MatchAllDocsQuery.cs


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