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


C# Monodoc.TermDocs方法代码示例

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


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

示例1: Scorer

			public virtual Scorer Scorer(Monodoc.Lucene.Net.Index.IndexReader reader)
			{
				TermDocs termDocs = reader.TermDocs(Enclosing_Instance.term);
				
				if (termDocs == null)
					return null;
				
				return new TermScorer(this, termDocs, Enclosing_Instance.GetSimilarity(searcher), reader.Norms(Enclosing_Instance.term.Field()));
			}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:9,代码来源:TermQuery.cs

示例2: Bits

		/// <summary> Returns a BitSet with true for documents which should be
		/// permitted in search results, and false for those that should
		/// not.
		/// </summary>
		public override System.Collections.BitArray Bits(Monodoc.Lucene.Net.Index.IndexReader reader)
		{
			System.Collections.BitArray bits = new System.Collections.BitArray((reader.MaxDoc() % 64 == 0?reader.MaxDoc() / 64:reader.MaxDoc() / 64 + 1) * 64);
			TermEnum enumerator = reader.Terms(new Term(field, start));
			TermDocs termDocs = reader.TermDocs();
			if (enumerator.Term() == null)
			{
				return bits;
			}
			
			try
			{
				Term stop = new Term(field, end);
				while (enumerator.Term().CompareTo(stop) <= 0)
				{
					termDocs.Seek(enumerator.Term());
					while (termDocs.Next())
					{
						bits.Set(termDocs.Doc(), true);
					}
					if (!enumerator.Next())
					{
						break;
					}
				}
			}
			finally
			{
				enumerator.Close();
				termDocs.Close();
			}
			return bits;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:37,代码来源:DateFilter.cs

示例3: TermDocs

		protected internal virtual TermDocs TermDocs(Monodoc.Lucene.Net.Index.IndexReader reader)
		{
			return reader.TermDocs();
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:4,代码来源:MultiReader.cs

示例4: GetCustom

		// inherit javadocs
		public virtual System.IComparable[] GetCustom(Monodoc.Lucene.Net.Index.IndexReader reader, System.String field, SortComparator comparator)
		{
			field = String.Intern(field);
			System.Object ret = Lookup(reader, field, comparator);
			if (ret == null)
			{
				System.IComparable[] retArray = new System.IComparable[reader.MaxDoc()];
				if (retArray.Length > 0)
				{
					TermDocs termDocs = reader.TermDocs();
					TermEnum termEnum = reader.Terms(new Term(field, ""));
					try
					{
						if (termEnum.Term() == null)
						{
							throw new System.SystemException("no terms in Field " + field);
						}
						do 
						{
							Term term = termEnum.Term();
							if ((System.Object) term.Field() != (System.Object) field)
								break;
							System.IComparable termval = comparator.GetComparable(term.Text());
							termDocs.Seek(termEnum);
							while (termDocs.Next())
							{
								retArray[termDocs.Doc()] = termval;
							}
						}
						while (termEnum.Next());
					}
					finally
					{
						termDocs.Close();
						termEnum.Close();
					}
				}
				Store(reader, field, SortField.CUSTOM, retArray);
				return retArray;
			}
			return (System.IComparable[]) ret;
		}
开发者ID:emtees,项目名称:old-code,代码行数:43,代码来源:FieldCacheImpl.cs

示例5: GetStringIndex

		// inherit javadocs
		public virtual StringIndex GetStringIndex(Monodoc.Lucene.Net.Index.IndexReader reader, System.String field)
		{
			field = String.Intern(field);
			System.Object ret = Lookup(reader, field, Monodoc.Lucene.Net.Search.FieldCache_Fields.STRING_INDEX);
			if (ret == null)
			{
				int[] retArray = new int[reader.MaxDoc()];
				System.String[] mterms = new System.String[reader.MaxDoc() + 1];
				if (retArray.Length > 0)
				{
					TermDocs termDocs = reader.TermDocs();
					TermEnum termEnum = reader.Terms(new Term(field, ""));
					int t = 0; // current term number
					
					// an entry for documents that have no terms in this Field
					// should a document with no terms be at top or bottom?
					// this puts them at the top - if it is changed, FieldDocSortedHitQueue
					// needs to change as well.
					mterms[t++] = null;
					
					try
					{
						if (termEnum.Term() == null)
						{
							throw new System.SystemException("no terms in Field " + field);
						}
						do 
						{
							Term term = termEnum.Term();
							if ((System.Object) term.Field() != (System.Object) field)
								break;
							
							// store term text
							// we expect that there is at most one term per document
							if (t >= mterms.Length)
								throw new System.SystemException("there are more terms than documents in Field \"" + field + "\"");
							mterms[t] = term.Text();
							
							termDocs.Seek(termEnum);
							while (termDocs.Next())
							{
								retArray[termDocs.Doc()] = t;
							}
							
							t++;
						}
						while (termEnum.Next());
					}
					finally
					{
						termDocs.Close();
						termEnum.Close();
					}
					
					if (t == 0)
					{
						// if there are no terms, make the term array
						// have a single null entry
						mterms = new System.String[1];
					}
					else if (t < mterms.Length)
					{
						// if there are less terms than documents,
						// trim off the dead array space
						System.String[] terms = new System.String[t];
						Array.Copy(mterms, 0, terms, 0, t);
						mterms = terms;
					}
				}
				StringIndex value_Renamed = new StringIndex(retArray, mterms);
				Store(reader, field, Monodoc.Lucene.Net.Search.FieldCache_Fields.STRING_INDEX, value_Renamed);
				return value_Renamed;
			}
			return (StringIndex) ret;
		}
开发者ID:emtees,项目名称:old-code,代码行数:76,代码来源:FieldCacheImpl.cs

示例6: GetFloats

		// inherit javadocs
		public virtual float[] GetFloats(Monodoc.Lucene.Net.Index.IndexReader reader, System.String field)
		{
			field = String.Intern(field);
			System.Object ret = Lookup(reader, field, SortField.FLOAT);
			if (ret == null)
			{
				float[] retArray = new float[reader.MaxDoc()];
				if (retArray.Length > 0)
				{
					TermDocs termDocs = reader.TermDocs();
					TermEnum termEnum = reader.Terms(new Term(field, ""));
                    try
                    {
                        if (termEnum.Term() == null)
                        {
                            throw new System.SystemException("no terms in Field " + field);
                        }
                        do 
                        {
                            Term term = termEnum.Term();
                            if ((System.Object) term.Field() != (System.Object) field)
                                break;
                            float termval;
                            try
                            {
                                termval = SupportClass.Single.Parse(term.Text());
                            }
                            catch (Exception e)
                            {
                                termval = 0;
                            }
                            termDocs.Seek(termEnum);
                            while (termDocs.Next())
                            {
                                retArray[termDocs.Doc()] = termval;
                            }
                        }
                        while (termEnum.Next());
                    }
                    finally
                    {
                        termDocs.Close();
                        termEnum.Close();
                    }
				}
				Store(reader, field, SortField.FLOAT, retArray);
				return retArray;
			}
			return (float[]) ret;
		}
开发者ID:emtees,项目名称:old-code,代码行数:51,代码来源:FieldCacheImpl.cs


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