Exemplo n.º 1
0
        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.GetValue();

            // 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;
        }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
			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;
			}
Exemplo n.º 4
0
		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.GetValue();
			
			// 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;
		}
Exemplo n.º 5
0
		/// <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;
		}
Exemplo n.º 6
0
        /// <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;
            }
        }
Exemplo n.º 7
0
            public ConstantScorer(ConstantScoreQuery enclosingInstance, Similarity similarity, IndexReader reader, Weight w) : base(similarity)
            {
                InitBlock(enclosingInstance);
                theScore = w.GetValue();
                DocIdSet docIdSet = Enclosing_Instance.filter.GetDocIdSet(reader);

                if (docIdSet == null)
                {
                    docIdSetIterator = DocIdSet.EMPTY_DOCIDSET.Iterator();
                }
                else
                {
                    DocIdSetIterator iter = docIdSet.Iterator();
                    if (iter == null)
                    {
                        docIdSetIterator = DocIdSet.EMPTY_DOCIDSET.Iterator();
                    }
                    else
                    {
                        docIdSetIterator = iter;
                    }
                }
            }
Exemplo n.º 8
0
			public ConstantScorer(ConstantScoreQuery enclosingInstance, Similarity similarity, IndexReader reader, Weight w):base(similarity)
			{
				InitBlock(enclosingInstance);
				theScore = w.GetValue();
				DocIdSet docIdSet = Enclosing_Instance.filter.GetDocIdSet(reader);
				if (docIdSet == null)
				{
					docIdSetIterator = DocIdSet.EMPTY_DOCIDSET.Iterator();
				}
				else
				{
					DocIdSetIterator iter = docIdSet.Iterator();
					if (iter == null)
					{
						docIdSetIterator = DocIdSet.EMPTY_DOCIDSET.Iterator();
					}
					else
					{
						docIdSetIterator = iter;
					}
				}
			}