public override bool Collect(BytesRef bytes) { int e = terms.Add(bytes); TermState state = termsEnum.GetTermState(); if (Debugging.AssertsEnabled) { Debugging.Assert(state != null); } if (e < 0) { // duplicate term: update docFreq int pos = (-e) - 1; array.termState[pos].Register(state, m_readerContext.Ord, termsEnum.DocFreq, termsEnum.TotalTermFreq); if (Debugging.AssertsEnabled) { Debugging.Assert(array.boost[pos] == boostAtt.Boost, "boost should be equal in all segment TermsEnums"); } } else { // new entry: we populate the entry initially array.boost[e] = boostAtt.Boost; array.termState[e] = new TermContext(m_topReaderContext, state, m_readerContext.Ord, termsEnum.DocFreq, termsEnum.TotalTermFreq); outerInstance.CheckMaxClauseCount(terms.Count); } return(true); }
public override bool Collect(BytesRef bytes) { int e = terms.Add(bytes); TermState state = termsEnum.GetTermState(); if (Debugging.AssertsEnabled) { Debugging.Assert(state != null); } if (e < 0) { // duplicate term: update docFreq int pos = (-e) - 1; array.termState[pos].Register(state, m_readerContext.Ord, termsEnum.DocFreq, termsEnum.TotalTermFreq); // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled if (Debugging.AssertsEnabled) { Debugging.Assert(NumericUtils.SingleToSortableInt32(array.boost[pos]) == NumericUtils.SingleToSortableInt32(boostAtt.Boost), "boost should be equal in all segment TermsEnums"); } } else { // new entry: we populate the entry initially array.boost[e] = boostAtt.Boost; array.termState[e] = new TermContext(m_topReaderContext, state, m_readerContext.Ord, termsEnum.DocFreq, termsEnum.TotalTermFreq); outerInstance.CheckMaxClauseCount(terms.Count); } return(true); }