コード例 #1
0
ファイル: OrdTermState.cs プロジェクト: Cefa68000/lucenenet
 public override void CopyFrom(TermState other)
 {
     Debug.Assert(other is OrdTermState, "can not copy from " + other.GetType().Name);
     this.Ord = ((OrdTermState)other).Ord;
 }
コード例 #2
0
ファイル: TermContext.cs プロジェクト: Cefa68000/lucenenet
 /// <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;
 }
コード例 #3
0
ファイル: TermContext.cs プロジェクト: Cefa68000/lucenenet
 /// <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);
 }
コード例 #4
0
ファイル: TermsEnum.cs プロジェクト: Cefa68000/lucenenet
 public override void SeekExact(BytesRef term, TermState state)
 {
     throw new InvalidOperationException("this method should never be called");
 }
コード例 #5
0
ファイル: TermsEnum.cs プロジェクト: Cefa68000/lucenenet
 public override void CopyFrom(TermState other)
 {
     throw new System.NotSupportedException();
 }
コード例 #6
0
ファイル: TermState.cs プロジェクト: Cefa68000/lucenenet
 /// <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);
コード例 #7
0
ファイル: OrdTermState.cs プロジェクト: zfxsss/lucenenet
 public override void CopyFrom(TermState other)
 {
     Debug.Assert(other is OrdTermState, "can not copy from " + other.GetType().Name);
     this.Ord = ((OrdTermState)other).Ord;
 }
コード例 #8
0
 public override void SeekExact(BytesRef term, TermState state)
 {
     Debug.Assert(term.IsValid());
     base.SeekExact(term, state);
     this.state = State.POSITIONED;
 }
コード例 #9
0
 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);
     }
 }
コード例 #10
0
 public override void SeekExact(BytesRef term, TermState state)
 {
     throw new InvalidOperationException("this method should never be called");
 }
コード例 #11
0
ファイル: TestTermsEnum.cs プロジェクト: zhangbo27/lucenenet
 public TermAndState(BytesRef term, TermState state)
 {
     this.Term  = term;
     this.State = state;
 }
コード例 #12
0
 public override void CopyFrom(TermState other)
 {
     throw new NotSupportedException();
 }
コード例 #13
0
 public override void SeekExact(BytesRef term, TermState state)
 {
     Debug.Assert(state != null && state is OrdTermState);
     this.SeekExact(((OrdTermState)state).Ord);
 }
コード例 #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");
 }
コード例 #15
0
ファイル: TestTermsEnum.cs プロジェクト: Cefa68000/lucenenet
 public TermAndState(BytesRef term, TermState state)
 {
     this.Term = term;
     this.State = state;
 }
コード例 #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");
 }
コード例 #17
0
 public override void SeekExact(BytesRef term, TermState state)
 {
     Debug.Assert(term.Valid);
     base.SeekExact(term, state);
     this.State = State_e.POSITIONED;
 }
コード例 #18
0
ファイル: TermsEnum.cs プロジェクト: Cefa68000/lucenenet
 /// <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");
     }
 }
コード例 #19
0
 public override void SeekExact(BytesRef term, TermState state)
 {
     Debug.Assert(state != null && state is OrdTermState);
     this.SeekExact(((OrdTermState)state).Ord);
 }
コード例 #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);
 }