// firstDocID is ignored since nextDoc() sets 'doc' public /*protected internal*/ override bool Score(Collector c, int end, int firstDocID) { c.SetScorer(this); while (doc < end) { // for docs in window c.Collect(doc); // collect score if (++pointer >= pointerMax) { pointerMax = termDocs.Read(docs, freqs); // refill buffers if (pointerMax != 0) { pointer = 0; } else { termDocs.Close(); // close stream doc = System.Int32.MaxValue; // set to sentinel value return(false); } } doc = docs[pointer]; } return(true); }
/// <summary>Optimized implementation. </summary> public virtual int Read(int[] docs, int[] freqs) { while (true) { while (current == null) { if (pointer < readers.Length) { // try next segment base_Renamed = starts[pointer]; current = TermDocs(pointer++); } else { return(0); } } int end = current.Read(docs, freqs); if (end == 0) { // none left in segment current = null; } else { // got some int b = base_Renamed; // adjust doc numbers for (int i = 0; i < end; i++) { docs[i] += b; } return(end); } } }
public override DocIdSet GetDocIdSet(IndexReader reader) { TermEnum enumerator = query.GetEnum(reader); try { // if current term in enum is null, the enum is empty -> shortcut if (enumerator.Term == null) { return(DocIdSet.EMPTY_DOCIDSET); } // else fill into an OpenBitSet OpenBitSet bitSet = new OpenBitSet(reader.MaxDoc); int[] docs = new int[32]; int[] freqs = new int[32]; TermDocs termDocs = reader.TermDocs(); try { int termCount = 0; do { Term term = enumerator.Term; if (term == null) { break; } termCount++; termDocs.Seek(term); while (true) { int count = termDocs.Read(docs, freqs); if (count != 0) { for (int i = 0; i < count; i++) { bitSet.Set(docs[i]); } } else { break; } } } while (enumerator.Next()); query.IncTotalNumberOfTerms(termCount); // {{Aroush-2.9}} is the use of 'temp' as is right? } finally { termDocs.Close(); } return(bitSet); } finally { enumerator.Close(); } }
public virtual int Read(int[] docs, int[] freqs) { if (termDocs == null) { return(0); } return(termDocs.Read(docs, freqs)); }
public override BitArray Bits(IndexReader indexReader) { BitArray bitarray = new BitArray(indexReader.MaxDoc()); int[] docs = new int[1]; int[] freq = new int[1]; TermDocs termDocs = indexReader.TermDocs( new Term(@"title", "t1")); int count = termDocs.Read(docs, freq); if (count == 1) { bitarray.Set(docs[0], true); } return(bitarray); }
/// <summary> /// 执行自定义过滤条件 /// </summary> /// <param name="reader"></param> /// <param name="openBitSet"></param> /// <param name="setOrClear">Set Or Clear</param> private void SetOrClear(IndexReader reader, OpenBitSet openBitSet, bool setOrClear) { if (!setOrClear) {//如果是清除操作,先把所有元素填满,都是1。 openBitSet.Set(0L, reader.MaxDoc); } FilterInfo filterInfo = FilterDict.FilterInfo(this._language); string[] values = filterInfo.Values; if (values != null) { TermDocs termDocs = null; foreach (string value in values) { if (filterInfo.FieldType == FieldType.DATETIME) { long ticks = DateTime.Parse(value).Ticks; termDocs = reader.TermDocs(new Term(filterInfo.FieldName, ticks.ToString())); } else { termDocs = reader.TermDocs(new Term(filterInfo.FieldName, value)); } int count = termDocs.Read(_doc, _freqs); if (count == 1) { if (setOrClear) { //显示 openBitSet.Set(_doc[0]); //将Document的Doc文档表示设置为1。 } else { //不显示 openBitSet.Clear(_doc[0]); //将Document的Doc文档表示设置为0。 } } } } }
public virtual int Read(int[] docs, int[] freqs) { return(in_Renamed.Read(docs, freqs)); }
public virtual int Read(int[] docs, int[] freqs, IState state) { return(in_Renamed.Read(docs, freqs, state)); }
public virtual int Read(int[] docs, int[] freqs) { return(termDocs.Read(docs, freqs)); }