• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Search.Similarity类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: DisjunctionMaxScorer

		/// <summary> Creates a new instance of DisjunctionMaxScorer
		/// 
		/// </summary>
		/// <param name="tieBreakerMultiplier">Multiplier applied to non-maximum-scoring subqueries for a
		/// document as they are summed into the result.
		/// </param>
		/// <param name="similarity">-- not used since our definition involves neither coord nor terms
		/// directly
		/// </param>
		/// <param name="subScorers">The sub scorers this Scorer should iterate on
		/// </param>
		/// <param name="numScorers">The actual number of scorers to iterate on. Note that the array's
		/// length may be larger than the actual number of scorers.
		/// </param>
		public DisjunctionMaxScorer(float tieBreakerMultiplier, Similarity similarity, Scorer[] subScorers, int numScorers):base(similarity)
		{
			
			this.tieBreakerMultiplier = tieBreakerMultiplier;
			// The passed subScorers array includes only scorers which have documents
			// (DisjunctionMaxQuery takes care of that), and their nextDoc() was already
			// called.
			this.subScorers = subScorers;
			this.numScorers = numScorers;
			
			Heapify();
		}
开发者ID:synhershko,项目名称:lucene.net,代码行数:26,代码来源:DisjunctionMaxScorer.cs


示例17: SectionSearchScorer

            public SectionSearchScorer(Query query, Similarity similarity, float score, IndexReader reader)
                : base(similarity)
            {
                _curScr = score;

                SectionSearchQueryPlanBuilder builer = new SectionSearchQueryPlanBuilder(reader);
                _plan = builer.GetPlan(query);
                if (_plan != null)
                {
                    _curDoc = -1;
                    //_more = true; // NOT USED
                }
                else
                {
                    _curDoc = DocIdSetIterator.NO_MORE_DOCS;
                    //_more = false;  // NOT USED
                }
            }
开发者ID:modulexcite,项目名称:BoboBrowse.Net,代码行数:18,代码来源:SectionSearchQuery.cs


示例18: FacetBasedBoostingScorer

            public FacetBasedBoostingScorer(FacetBasedBoostScorerBuilder parent, BoboIndexReader reader, Similarity similarity, Scorer innerScorer)
                : base(similarity)
            {
                _innerScorer = innerScorer;

                List<BoboDocScorer> list = new List<BoboDocScorer>();

                foreach (var boostEntry in parent._boostMaps)
                {
                    string facetName = boostEntry.Key;
                    IFacetHandler handler = reader.GetFacetHandler(facetName);
                    if (!(handler is IFacetScoreable))
                        throw new ArgumentException(facetName + " does not implement FacetScoreable");
                    IFacetScoreable facetScoreable = (IFacetScoreable)handler;
                    BoboDocScorer scorer = facetScoreable.GetDocScorer(reader, parent._scoringFunctionFactory, boostEntry.Value);
                    if (scorer != null) list.Add(scorer);
                }
                _facetScorers = list.ToArray();
                _docid = -1;
            }
开发者ID:modulexcite,项目名称:BoboBrowse.Net,代码行数:20,代码来源:FacetBasedBoostScorerBuilder.cs


示例19: BooleanScorer

        /*internal*/
        public BooleanScorer(Similarity similarity, int minNrShouldMatch, System.Collections.IList optionalScorers, System.Collections.IList prohibitedScorers)
            : base(similarity)
        {
            InitBlock();
            this.minNrShouldMatch = minNrShouldMatch;

            if (optionalScorers != null && optionalScorers.Count > 0)
            {
                for (System.Collections.IEnumerator si = optionalScorers.GetEnumerator(); si.MoveNext(); )
                {
                    Scorer scorer = (Scorer) si.Current;
                    maxCoord++;
                    if (scorer.NextDoc() != NO_MORE_DOCS)
                    {
                        scorers = new SubScorer(scorer, false, false, bucketTable.NewCollector(0), scorers);
                    }
                }
            }

            if (prohibitedScorers != null && prohibitedScorers.Count > 0)
            {
                for (System.Collections.IEnumerator si = prohibitedScorers.GetEnumerator(); si.MoveNext(); )
                {
                    Scorer scorer = (Scorer) si.Current;
                    int mask = nextMask;
                    nextMask = nextMask << 1;
                    prohibitedMask |= mask; // update prohibited mask
                    if (scorer.NextDoc() != NO_MORE_DOCS)
                    {
                        scorers = new SubScorer(scorer, false, true, bucketTable.NewCollector(mask), scorers);
                    }
                }
            }

            coordFactors = new float[maxCoord];
            Similarity sim = GetSimilarity();
            for (int i = 0; i < maxCoord; i++)
            {
                coordFactors[i] = sim.Coord(i, maxCoord - 1);
            }
        }
开发者ID:BackupTheBerlios,项目名称:lyra2-svn,代码行数:42,代码来源:BooleanScorer.cs


示例20: BooleanScorer2

        /// <summary> Creates a {@link Scorer} with the given similarity and lists of required,
        /// prohibited and optional scorers. In no required scorers are added, at least
        /// one of the optional scorers will have to match during the search.
        /// 
        /// </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>
        /// <param name="required">the list of required scorers.
        /// </param>
        /// <param name="prohibited">the list of prohibited scorers.
        /// </param>
        /// <param name="optional">the list of optional scorers.
        /// </param>
        public BooleanScorer2(Similarity similarity, int minNrShouldMatch, System.Collections.IList required, System.Collections.IList prohibited, System.Collections.IList optional)
            : 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;

            optionalScorers = optional;
            coordinator.maxCoord += optional.Count;

            requiredScorers = required;
            coordinator.maxCoord += required.Count;

            prohibitedScorers = prohibited;

            coordinator.Init();
            countingSumScorer = MakeCountingSumScorer();
        }
开发者ID:BackupTheBerlios,项目名称:lyra2-svn,代码行数:38,代码来源:BooleanScorer2.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Search.Sort类代码示例发布时间:2022-05-26
下一篇:
C# Search.Searcher类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap