Esempio n. 1
0
 public override void CopyFrom(TermState other)
 {
     Debug.Assert(other is OrdTermState, "can not copy from " + other.GetType().Name);
     this.Ord = ((OrdTermState)other).Ord;
 }
Esempio n. 2
0
 /// <summary>
 /// Registers and associates a <seealso cref="TermState"/> with an leaf ordinal. The leaf ordinal
 /// should be derived from a <seealso cref="IndexReaderContext"/>'s leaf ord.
 /// </summary>
 public void Register(TermState state, int ord, int docFreq, long totalTermFreq)
 {
     Debug.Assert(state != null, "state must not be null");
     Debug.Assert(ord >= 0 && ord < States.Length);
     Debug.Assert(States[ord] == null, "state for ord: " + ord + " already registered");
     this.docFreq += docFreq;
     if (this.totalTermFreq >= 0 && totalTermFreq >= 0)
     {
         this.totalTermFreq += totalTermFreq;
     }
     else
     {
         this.totalTermFreq = -1;
     }
     States[ord] = state;
 }
Esempio n. 3
0
 /// <summary>
 /// Creates a <seealso cref="TermContext"/> with an initial <seealso cref="TermState"/>,
 /// <seealso cref="IndexReader"/> pair.
 /// </summary>
 public TermContext(IndexReaderContext context, TermState state, int ord, int docFreq, long totalTermFreq)
     : this(context)
 {
     Register(state, ord, docFreq, totalTermFreq);
 }
Esempio n. 4
0
 public override void SeekExact(BytesRef term, TermState state)
 {
     throw new InvalidOperationException("this method should never be called");
 }
Esempio n. 5
0
 public override void CopyFrom(TermState other)
 {
     throw new System.NotSupportedException();
 }
Esempio n. 6
0
 /// <summary>
 /// Copies the content of the given <seealso cref="TermState"/> to this instance
 /// </summary>
 /// <param name="other">
 ///          the TermState to copy </param>
 public abstract void CopyFrom(TermState other);
Esempio n. 7
0
 public override void CopyFrom(TermState other)
 {
     Debug.Assert(other is OrdTermState, "can not copy from " + other.GetType().Name);
     this.Ord = ((OrdTermState)other).Ord;
 }
Esempio n. 8
0
 public override void SeekExact(BytesRef term, TermState state)
 {
     Debug.Assert(term.IsValid());
     base.SeekExact(term, state);
     this.state = State.POSITIONED;
 }
 public override void CopyFrom(TermState other)
 {
     base.CopyFrom(other);
     var _other = (PulsingTermState) other;
     PostingsSize = _other.PostingsSize;
     if (_other.PostingsSize != -1)
     {
         if (Postings == null || Postings.Length < _other.PostingsSize)
         {
             Postings = new byte[ArrayUtil.Oversize(_other.PostingsSize, 1)];
         }
         System.Array.Copy(_other.Postings, 0, Postings, 0, _other.PostingsSize);
     }
     else
     {
         WrappedTermState.CopyFrom(_other.WrappedTermState);
     }
 }
Esempio n. 10
0
 public override void SeekExact(BytesRef term, TermState state)
 {
     throw new InvalidOperationException("this method should never be called");
 }
Esempio n. 11
0
 public TermAndState(BytesRef term, TermState state)
 {
     this.Term  = term;
     this.State = state;
 }
Esempio n. 12
0
 public override void CopyFrom(TermState other)
 {
     throw new NotSupportedException();
 }
Esempio n. 13
0
 public override void SeekExact(BytesRef term, TermState state)
 {
     Debug.Assert(state != null && state is OrdTermState);
     this.SeekExact(((OrdTermState)state).Ord);
 }
Esempio n. 14
0
 /// <summary>
 /// this enum does not support seeking! </summary>
 /// <exception cref="NotSupportedException"> In general, subclasses do not
 ///         support seeking. </exception>
 public override void SeekExact(BytesRef term, TermState state)
 {
     throw new NotSupportedException(this.GetType().Name + " does not support seeking");
 }
Esempio n. 15
0
 public TermAndState(BytesRef term, TermState state)
 {
     this.Term = term;
     this.State = state;
 }
Esempio n. 16
0
 /// <summary>
 /// this enum does not support seeking! </summary>
 /// <exception cref="UnsupportedOperationException"> In general, subclasses do not
 ///         support seeking. </exception>
 public override void SeekExact(BytesRef term, TermState state)
 {
     throw new System.NotSupportedException(this.GetType().Name + " does not support seeking");
 }
Esempio n. 17
0
 public override void SeekExact(BytesRef term, TermState state)
 {
     Debug.Assert(term.Valid);
     base.SeekExact(term, state);
     this.State = State_e.POSITIONED;
 }
Esempio n. 18
0
 /// <summary>
 /// Expert: Seeks a specific position by <seealso cref="TermState"/> previously obtained
 /// from <seealso cref="#termState()"/>. Callers should maintain the <seealso cref="TermState"/> to
 /// use this method. Low-level implementations may position the TermsEnum
 /// without re-seeking the term dictionary.
 /// <p>
 /// Seeking by <seealso cref="TermState"/> should only be used iff the state was obtained
 /// from the same <seealso cref="TermsEnum"/> instance.
 /// <p>
 /// NOTE: Using this method with an incompatible <seealso cref="TermState"/> might leave
 /// this <seealso cref="TermsEnum"/> in undefined state. On a segment level
 /// <seealso cref="TermState"/> instances are compatible only iff the source and the
 /// target <seealso cref="TermsEnum"/> operate on the same field. If operating on segment
 /// level, TermState instances must not be used across segments.
 /// <p>
 /// NOTE: A seek by <seealso cref="TermState"/> might not restore the
 /// <seealso cref="AttributeSource"/>'s state. <seealso cref="AttributeSource"/> states must be
 /// maintained separately if this method is used. </summary>
 /// <param name="term"> the term the TermState corresponds to </param>
 /// <param name="state"> the <seealso cref="TermState"/>
 ///  </param>
 public virtual void SeekExact(BytesRef term, TermState state)
 {
     if (!SeekExact(term))
     {
         throw new System.ArgumentException("term=" + term + " does not exist");
     }
 }
 public override void SeekExact(BytesRef term, TermState state)
 {
     Debug.Assert(state != null && state is OrdTermState);
     this.SeekExact(((OrdTermState)state).Ord);
 }
Esempio n. 20
0
 /// <summary>
 /// Creates a <see cref="TermContext"/> with an initial <see cref="TermState"/>,
 /// <see cref="IndexReader"/> pair.
 /// </summary>
 public TermContext(IndexReaderContext context, TermState state, int ord, int docFreq, long totalTermFreq)
     : this(context)
 {
     Register(state, ord, docFreq, totalTermFreq);
 }