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


C# Index.IndexReader类代码示例

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


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

示例1: SegmentMergeInfo

		internal SegmentMergeInfo(int b, TermEnum te, IndexReader r)
		{
			base_Renamed = b;
			reader = r;
			termEnum = te;
			term = te.Term;
		}
开发者ID:mindis,项目名称:Transformalize,代码行数:7,代码来源:SegmentMergeInfo.cs

示例2: 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:mindis,项目名称:Transformalize,代码行数:16,代码来源:ReaderUtil.cs

示例3: MatchAllScorer

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

示例4: Initialize

 private void  Initialize(IndexReader[] subReaders, bool closeSubReaders)
 {
     // Deep copy
     this.subReaders = subReaders.ToArray();
     starts = new int[subReaders.Length + 1]; // build starts array
     decrefOnClose = new bool[subReaders.Length];
     for (int i = 0; i < subReaders.Length; i++)
     {
         starts[i] = maxDoc;
         maxDoc += subReaders[i].MaxDoc; // compute maxDocs
         
         if (!closeSubReaders)
         {
             subReaders[i].IncRef();
             decrefOnClose[i] = true;
         }
         else
         {
             decrefOnClose[i] = false;
         }
         
         if (subReaders[i].HasDeletions)
             hasDeletions = true;
     }
     starts[subReaders.Length] = maxDoc;
 }
开发者ID:mindis,项目名称:Transformalize,代码行数:26,代码来源:MultiReader.cs

示例5: TermRangeTermEnum

		/// <summary> Enumerates all terms greater/equal than <c>lowerTerm</c>
		/// but less/equal than <c>upperTerm</c>. 
		/// 
		/// If an endpoint is null, it is said to be "open". Either or both 
		/// endpoints may be open.  Open endpoints may not be exclusive 
		/// (you can't select all but the first or last term without 
		/// explicitly specifying the term to exclude.)
		/// 
		/// </summary>
		/// <param name="reader">
		/// </param>
		/// <param name="field">An interned field that holds both lower and upper terms.
		/// </param>
		/// <param name="lowerTermText">The term text at the lower end of the range
		/// </param>
		/// <param name="upperTermText">The term text at the upper end of the range
		/// </param>
		/// <param name="includeLower">If true, the <c>lowerTerm</c> is included in the range.
		/// </param>
		/// <param name="includeUpper">If true, the <c>upperTerm</c> is included in the range.
		/// </param>
		/// <param name="collator">The collator to use to collate index Terms, to determine their
		/// membership in the range bounded by <c>lowerTerm</c> and
		/// <c>upperTerm</c>.
		/// 
		/// </param>
		/// <throws>  IOException </throws>
		public TermRangeTermEnum(IndexReader reader, System.String field, System.String lowerTermText, System.String upperTermText, bool includeLower, bool includeUpper, System.Globalization.CompareInfo collator)
		{
			this.collator = collator;
			this.upperTermText = upperTermText;
			this.lowerTermText = lowerTermText;
			this.includeLower = includeLower;
			this.includeUpper = includeUpper;
			this.field = StringHelper.Intern(field);
			
			// do a little bit of normalization...
			// open ended range queries should always be inclusive.
			if (this.lowerTermText == null)
			{
				this.lowerTermText = "";
				this.includeLower = true;
			}
			
			if (this.upperTermText == null)
			{
				this.includeUpper = true;
			}
			
			System.String startTermText = collator == null?this.lowerTermText:"";
			SetEnum(reader.Terms(new Term(this.field, startTermText)));
		}
开发者ID:mindis,项目名称:Transformalize,代码行数:52,代码来源:TermRangeTermEnum.cs

示例6: Purge

 // lucene.net: java version 3.0.3 with patch in rev. 912330 applied:
 // uschindler 21/02/2010 12:16:42 LUCENE-2273: Fixed bug in FieldCacheImpl.getCacheEntries() that used 
 //                     WeakHashMap incorrectly and lead to ConcurrentModificationException
 public void Purge(IndexReader r)
 {
     lock (this)
     {
         foreach (Cache c in caches.Values)
         {
             c.Purge(r);
         }
     }
 }
开发者ID:mindis,项目名称:Transformalize,代码行数:13,代码来源:FieldCacheImpl.cs

示例7: Explain

		public override Explanation Explain(IndexReader reader, int doc)
		{
			
			ComplexExplanation result = new ComplexExplanation();
			result.Description = "weight(" + Query + " in " + doc + "), product of:";
			System.String field = ((SpanQuery) Query).Field;
			
			Explanation idfExpl = new Explanation(idf, "idf(" + field + ": " + idfExp.Explain() + ")");
			
			// explain query weight
			Explanation queryExpl = new Explanation();
			queryExpl.Description = "queryWeight(" + Query + "), product of:";
			
			Explanation boostExpl = new Explanation(Query.Boost, "boost");
			if (Query.Boost != 1.0f)
				queryExpl.AddDetail(boostExpl);
			queryExpl.AddDetail(idfExpl);
			
			Explanation queryNormExpl = new Explanation(queryNorm, "queryNorm");
			queryExpl.AddDetail(queryNormExpl);
			
			queryExpl.Value = boostExpl.Value * idfExpl.Value * queryNormExpl.Value;
			
			result.AddDetail(queryExpl);
			
			// explain field weight
			ComplexExplanation fieldExpl = new ComplexExplanation();
			fieldExpl.Description = "fieldWeight(" + field + ":" + internalQuery.ToString(field) + " in " + doc + "), product of:";
			
			Explanation tfExpl = ((SpanScorer)Scorer(reader, true, false)).Explain(doc);
			fieldExpl.AddDetail(tfExpl);
			fieldExpl.AddDetail(idfExpl);
			
			Explanation fieldNormExpl = new Explanation();
			byte[] fieldNorms = reader.Norms(field);
			float fieldNorm = fieldNorms != null?Similarity.DecodeNorm(fieldNorms[doc]):1.0f;
			fieldNormExpl.Value = fieldNorm;
			fieldNormExpl.Description = "fieldNorm(field=" + field + ", doc=" + doc + ")";
			fieldExpl.AddDetail(fieldNormExpl);
			
			fieldExpl.Match = tfExpl.IsMatch;
			fieldExpl.Value = tfExpl.Value * idfExpl.Value * fieldNormExpl.Value;
			
			result.AddDetail(fieldExpl);
			System.Boolean? tempAux = fieldExpl.Match;
			result.Match = tempAux;
			
			// combine them
			result.Value = queryExpl.Value * fieldExpl.Value;
			
			if (queryExpl.Value == 1.0f)
				return fieldExpl;
			
			return result;
		}
开发者ID:mindis,项目名称:Transformalize,代码行数:55,代码来源:SpanWeight.cs

示例8: GetEnum

		protected internal override FilteredTermEnum GetEnum(IndexReader reader)
		{
            if (_termContainsWildcard)
            {
                return new WildcardTermEnum(reader, Term);
            }
            else
            {
                return new SingleTermEnum(reader, Term);
            }
		}
开发者ID:mindis,项目名称:Transformalize,代码行数:11,代码来源:WildcardQuery.cs

示例9: Rewrite

	    public override Query Rewrite(IndexReader reader)
		{
            if (_termIsPrefix)
            {
                MultiTermQuery rewritten =
                    new PrefixQuery(internalTerm.CreateTerm(internalTerm.Text.Substring(0, internalTerm.Text.IndexOf('*'))));
                rewritten.Boost = Boost;
                rewritten.RewriteMethod = RewriteMethod;
                return rewritten;
            }
            else
            {
                return base.Rewrite(reader);
            }
		}
开发者ID:mindis,项目名称:Transformalize,代码行数:15,代码来源:WildcardQuery.cs

示例10: GatherSubReaders

		/// <summary>Gathers sub-readers from reader into a List.</summary>
		/// <param name="allSubReaders"></param>
		/// <param name="reader"></param>
		public static void GatherSubReaders(System.Collections.Generic.IList<IndexReader> allSubReaders, IndexReader reader)
		{
			IndexReader[] subReaders = reader.GetSequentialSubReaders();
			if (subReaders == null)
			{
				// Add the reader itself, and do not recurse
				allSubReaders.Add(reader);
			}
			else
			{
				for (int i = 0; i < subReaders.Length; i++)
				{
					GatherSubReaders(allSubReaders, subReaders[i]);
				}
			}
		}
开发者ID:mindis,项目名称:Transformalize,代码行数:19,代码来源:ReaderUtil.cs

示例11: BitSpans

		public override SpanFilterResult BitSpans(IndexReader reader)
		{
			
			OpenBitSet bits = new OpenBitSet(reader.MaxDoc);
			Lucene.Net.Search.Spans.Spans spans = internalQuery.GetSpans(reader);
			IList<SpanFilterResult.PositionInfo> tmp = new List<SpanFilterResult.PositionInfo>(20);
			int currentDoc = - 1;
			SpanFilterResult.PositionInfo currentInfo = null;
			while (spans.Next())
			{
				int doc = spans.Doc();
				bits.Set(doc);
				if (currentDoc != doc)
				{
					currentInfo = new SpanFilterResult.PositionInfo(doc);
					tmp.Add(currentInfo);
					currentDoc = doc;
				}
				currentInfo.AddPosition(spans.Start(), spans.End());
			}
			return new SpanFilterResult(bits, tmp);
		}
开发者ID:mindis,项目名称:Transformalize,代码行数:22,代码来源:SpanQueryFilter.cs

示例12: Rewrite

		/*(non-Javadoc) <see cref="Lucene.Net.Search.Query.rewrite(Lucene.Net.Index.IndexReader) */
        public override Query Rewrite(IndexReader reader)
        {
            CustomScoreQuery clone = null;

            Query sq = subQuery.Rewrite(reader);
            if (sq != subQuery)
            {
                clone = (CustomScoreQuery)Clone();
                clone.subQuery = sq;
            }

            for (int i = 0; i < valSrcQueries.Length; i++)
            {
                ValueSourceQuery v = (ValueSourceQuery)valSrcQueries[i].Rewrite(reader);
                if (v != valSrcQueries[i])
                {
                    if (clone == null) clone = (CustomScoreQuery)Clone();
                    clone.valSrcQueries[i] = v;
                }
            }

            return (clone == null) ? this : clone;
        }
开发者ID:mindis,项目名称:Transformalize,代码行数:24,代码来源:CustomScoreQuery.cs

示例13: WildcardTermEnum

		/// <summary> Creates a new <c>WildcardTermEnum</c>.
		/// <p/>
		/// After calling the constructor the enumeration is already pointing to the first 
		/// valid term if such a term exists.
		/// </summary>
		public WildcardTermEnum(IndexReader reader, Term term):base()
		{
			searchTerm = term;
			field = searchTerm.Field;
			System.String searchTermText = searchTerm.Text;
			
			int sidx = searchTermText.IndexOf((System.Char) WILDCARD_STRING);
			int cidx = searchTermText.IndexOf((System.Char) WILDCARD_CHAR);
			int idx = sidx;
			if (idx == - 1)
			{
				idx = cidx;
			}
			else if (cidx >= 0)
			{
				idx = System.Math.Min(idx, cidx);
			}
			pre = idx != - 1?searchTerm.Text.Substring(0, (idx) - (0)):"";
			
			preLen = pre.Length;
			text = searchTermText.Substring(preLen);
			SetEnum(reader.Terms(new Term(searchTerm.Field, pre)));
		}
开发者ID:mindis,项目名称:Transformalize,代码行数:28,代码来源:WildcardTermEnum.cs

示例14: GetValues

		/*(non-Javadoc) <see cref="Lucene.Net.Search.Function.ValueSource.getValues(Lucene.Net.Index.IndexReader) */
		public override DocValues GetValues(IndexReader reader)
		{
			int[] arr = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetStringIndex(reader, field).order;
			return new AnonymousClassDocValues(arr, this);
		}
开发者ID:mindis,项目名称:Transformalize,代码行数:6,代码来源:OrdFieldSource.cs

示例15: GetDocIdSet

	    public override DocIdSet GetDocIdSet(IndexReader reader)
		{
			return new FieldCacheTermsFilterDocIdSet(this, FieldCache.GetStringIndex(reader, field));
		}
开发者ID:mindis,项目名称:Transformalize,代码行数:4,代码来源:FieldCacheTermsFilter.cs


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