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


C# Search.Similarity类代码示例

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


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

示例1: TermWeight

			public TermWeight(TermQuery enclosingInstance, Searcher searcher)
			{
				InitBlock(enclosingInstance);
				this.similarity = Enclosing_Instance.GetSimilarity(searcher);
				idfExp = similarity.IdfExplain(Enclosing_Instance.term, searcher);
				idf = idfExp.Idf;
			}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:7,代码来源:TermQuery.cs

示例2: phraseFreq

		private float freq; //prhase frequency in current doc as computed by phraseFreq().
		
		internal PhraseScorer(Weight weight, TermPositions[] tps, int[] offsets, Similarity similarity, byte[] norms):base(similarity)
		{
			this.norms = norms;
			this.weight = weight;
			this.value_Renamed = weight.Value;
			
			// convert tps to a list of phrase positions.
			// note: phrase-position differs from term-position in that its position
			// reflects the phrase offset: pp.pos = tp.pos - offset.
			// this allows to easily identify a matching (exact) phrase 
			// when all PhrasePositions have exactly the same position.
			for (int i = 0; i < tps.Length; i++)
			{
				PhrasePositions pp = new PhrasePositions(tps[i], offsets[i]);
				if (last != null)
				{
					// add next to end of list
					last.next = pp;
				}
				else
				{
					first = pp;
				}
				last = pp;
			}
			
			pq = new PhraseQueue(tps.Length); // construct empty pq
			first.doc = - 1;
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:31,代码来源:PhraseScorer.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:modulexcite,项目名称:Xamarin-Lucene.Net,代码行数:7,代码来源:MatchAllDocsQuery.cs

示例4: MatchAllScorer

			internal MatchAllScorer(MatchAllDocsQuery enclosingInstance, IndexReader reader, Similarity similarity) : base(similarity)
			{
				InitBlock(enclosingInstance);
				this.reader = reader;
				count = - 1;
				maxDoc = reader.MaxDoc();
			}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:7,代码来源:MatchAllDocsQuery.cs

示例5: DocSetIteratorWeight

 internal DocSetIteratorWeight(Query query, Similarity similarity, DocIdSetIterator iter)
 {
     _query = query;
     _similarity = similarity;
     _iter = iter;
     _queryNorm = 1.0f;
     _queryWeight = _query.Boost;
 }
开发者ID:NightOwl888,项目名称:Bobo-Browse.Net,代码行数:8,代码来源:DocsetQuery.cs

示例6: TermWeight

 public TermWeight(TermQuery outerInstance, IndexSearcher searcher, TermContext termStates)
 {
     this.OuterInstance = outerInstance;
     Debug.Assert(termStates != null, "TermContext must not be null");
     this.TermStates = termStates;
     this.Similarity = searcher.Similarity;
     this.Stats = Similarity.ComputeWeight(outerInstance.Boost, searcher.CollectionStatistics(outerInstance.Term_Renamed.Field()), searcher.TermStatistics(outerInstance.Term_Renamed, termStates));
 }
开发者ID:paulirwin,项目名称:lucene.net,代码行数:8,代码来源:TermQuery.cs

示例7: MatchAllScorer

			internal MatchAllScorer(MatchAllDocsQuery enclosingInstance, IndexReader reader, Similarity similarity, Weight w):base(similarity)
			{
				InitBlock(enclosingInstance);
				this.reader = reader;
				id = - 1;
				maxId = reader.MaxDoc() - 1;
				score = w.GetValue();
			}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:8,代码来源:MatchAllDocsQuery.cs

示例8: SpanWeight

		public SpanWeight(SpanQuery query, Searcher searcher)
		{
			this.similarity = query.GetSimilarity(searcher);
			this.query = query;
			terms = new System.Collections.Hashtable();
			query.ExtractTerms(terms);
			idfExp = similarity.idfExplain(new System.Collections.ArrayList(terms.Values), searcher);
			idf = idfExp.GetIdf();
		}
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:9,代码来源:SpanWeight.cs

示例9: SpanWeight

		public SpanWeight(SpanQuery query, Searcher searcher)
		{
			this.similarity = query.GetSimilarity(searcher);
			this.query = query;
            terms = new Support.Set<Lucene.Net.Index.Term>();
			query.ExtractTerms(terms);
			idfExp = similarity.idfExplain(terms.ToArray(), searcher);
			idf = idfExp.GetIdf();
		}
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:9,代码来源:SpanWeight.cs

示例10: ConjunctionScorer

        public ConjunctionScorer(Similarity similarity, Scorer[] scorers)
            : base(similarity)
        {
            this.scorers = scorers;
            coord = similarity.Coord(scorers.Length, scorers.Length);

            for (int i = 0; i < scorers.Length; i++)
            {
                if (scorers[i].NextDoc() == NO_MORE_DOCS)
                {
                    // If even one of the sub-scorers does not have any documents, this
                    // scorer should not attempt to do any more work.
                    lastDoc = NO_MORE_DOCS;
                    return ;
                }
            }

            // Sort the array the first time...
            // We don't need to sort the array in any future calls because we know
            // it will already start off sorted (all scorers on same doc).

            // note that this comparator is not consistent with equals!
            System.Array.Sort(scorers, new AnonymousClassComparator(this));

            // NOTE: doNext() must be called before the re-sorting of the array later on.
            // The reason is this: assume there are 5 scorers, whose first docs are 1,
            // 2, 3, 5, 5 respectively. Sorting (above) leaves the array as is. Calling
            // doNext() here advances all the first scorers to 5 (or a larger doc ID
            // they all agree on).
            // However, if we re-sort before doNext() is called, the order will be 5, 3,
            // 2, 1, 5 and then doNext() will stop immediately, since the first scorer's
            // docs equals the last one. So the invariant that after calling doNext()
            // all scorers are on the same doc ID is broken.
            if (DoNext() == NO_MORE_DOCS)
            {
                // The scorers did not agree on any document.
                lastDoc = NO_MORE_DOCS;
                return ;
            }

            // If first-time skip distance is any predictor of
            // scorer sparseness, then we should always try to skip first on
            // those scorers.
            // Keep last scorer in it's last place (it will be the first
            // to be skipped on), but reverse all of the others so that
            // they will be skipped on in order of original high skip.
            int end = scorers.Length - 1;
            int max = end >> 1;
            for (int i = 0; i < max; i++)
            {
                Scorer tmp = scorers[i];
                int idx = end - i - 1;
                scorers[i] = scorers[idx];
                scorers[idx] = tmp;
            }
        }
开发者ID:BackupTheBerlios,项目名称:lyra2-svn,代码行数:56,代码来源:ConjunctionScorer.cs

示例11: BooleanScorer2

 /// <summary>Create a BooleanScorer2.</summary>
 /// <param name="similarity">The similarity to be used.
 /// </param>
 /// <param name="minNrShouldMatch">The minimum number of optional added scorers
 /// that should match during the search.
 /// In case no required scorers are added,
 /// at least one of the optional scorers will have to
 /// match during the search.
 /// </param>
 public BooleanScorer2(Similarity similarity, int minNrShouldMatch)
     : base(similarity)
 {
     if (minNrShouldMatch < 0)
     {
         throw new System.ArgumentException("Minimum number of optional scorers should not be negative");
     }
     coordinator = new Coordinator(this);
     this.minNrShouldMatch = minNrShouldMatch;
 }
开发者ID:vineelkovvuri,项目名称:ExtendableDesktopSearch,代码行数:19,代码来源:BooleanScorer2.cs

示例12: TermScorer

		/// <summary> Construct a <code>TermScorer</code>.
		/// 
		/// </summary>
		/// <param name="weight">The weight of the <code>Term</code> in the query.
		/// </param>
		/// <param name="td">An iterator over the documents matching the <code>Term</code>.
		/// </param>
		/// <param name="similarity">The <code>Similarity</code> implementation to be used for score
		/// computations.
		/// </param>
		/// <param name="norms">The field norms of the document fields for the <code>Term</code>.
		/// </param>
		public /*internal*/ TermScorer(Weight weight, TermDocs td, Similarity similarity, byte[] norms):base(similarity)
		{
			this.weight = weight;
			this.termDocs = td;
			this.norms = norms;
			this.weightValue = weight.GetValue();
			
			for (int i = 0; i < SCORE_CACHE_SIZE; i++)
				scoreCache[i] = GetSimilarity().Tf(i) * weightValue;
		}
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:22,代码来源:TermScorer.cs

示例13: SpanWeight

        public SpanWeight(SpanQuery query, Searcher searcher)
        {
            this.similarity = query.GetSimilarity(searcher);
            this.query = query;
            terms = new System.Collections.Hashtable();
            query.ExtractTerms(terms);

            System.Collections.ArrayList tmp = new System.Collections.ArrayList(terms.Values);

            idf = this.query.GetSimilarity(searcher).Idf(tmp, searcher);
        }
开发者ID:cqm0609,项目名称:lucene-file-finder,代码行数:11,代码来源:SpanWeight.cs

示例14: FastMatchAllScorer

 public FastMatchAllScorer(int maxdoc, int[] delDocs, Similarity similarity, float score)
     : base(similarity)
 {
     doc = -1;
     deletedDocs = delDocs;
     deletedIndex = 0;
     moreDeletions = deletedDocs != null && deletedDocs.Length > 0;
     delLen = deletedDocs != null ? deletedDocs.Length : 0;
     this.score = score;
     maxDoc = maxdoc;
 }
开发者ID:NightOwl888,项目名称:Bobo-Browse.Net,代码行数:11,代码来源:FastMatchAllDocsQuery.cs

示例15: SpanWeight

        public SpanWeight(SpanQuery query, Searcher searcher)
        {
            this.similarity = query.GetSimilarity(searcher);
            this.internalQuery = query;

            terms = Lucene.Net.Support.Compatibility.SetFactory.CreateHashSet<Term>();
            query.ExtractTerms(terms);

            idfExp = similarity.IdfExplain(terms, searcher);
            idf = idfExp.Idf;
        }
开发者ID:Nangal,项目名称:lucene.net,代码行数:11,代码来源:SpanWeight.cs


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