public override SeekStatus SeekCeil(BytesRef text) { long ord = values.LookupTerm(text); if (ord >= 0) { currentOrd = ord; term.Offset = 0; // TODO: is there a cleaner way? // term.bytes may be pointing to codec-private byte[] // storage, so we must force new byte[] allocation: term.Bytes = new byte[text.Length]; term.CopyBytes(text); return(SeekStatus.FOUND); } else { currentOrd = -ord - 1; if (currentOrd == values.ValueCount) { return(SeekStatus.END); } else { // TODO: hmm can we avoid this "extra" lookup?: values.LookupOrd(currentOrd, term); return(SeekStatus.NOT_FOUND); } } }
public override long LookupTerm(BytesRef key) { Debug.Assert(key.IsValid()); long result = @in.LookupTerm(key); Debug.Assert(result < valueCount); Debug.Assert(key.IsValid()); return(result); }
public override long LookupTerm(BytesRef key) { Debug.Assert(key.Valid); long result = @in.LookupTerm(key); Debug.Assert(result < ValueCount_Renamed); Debug.Assert(key.Valid); return(result); }
public override long LookupTerm(BytesRef key) { if (Debugging.AssertsEnabled) { Debugging.Assert(key.IsValid()); } long result = @in.LookupTerm(key); if (Debugging.AssertsEnabled) { Debugging.Assert(result < valueCount); } if (Debugging.AssertsEnabled) { Debugging.Assert(key.IsValid()); } return(result); }
internal SlowMinShouldMatchScorer(BooleanWeight weight, AtomicReader reader, IndexSearcher searcher) : base(weight) { this.Dv = reader.GetSortedSetDocValues("dv"); this.MaxDoc = reader.MaxDoc; BooleanQuery bq = (BooleanQuery)weight.Query; this.MinNrShouldMatch = bq.MinimumNumberShouldMatch; this.Sims = new SimScorer[(int)Dv.ValueCount]; foreach (BooleanClause clause in bq.Clauses) { Debug.Assert(!clause.Prohibited); Debug.Assert(!clause.Required); Term term = ((TermQuery)clause.Query).Term; long ord = Dv.LookupTerm(term.Bytes); if (ord >= 0) { bool success = Ords.Add(ord); Debug.Assert(success); // no dups TermContext context = TermContext.Build(reader.Context, term); SimWeight w = weight.Similarity.ComputeWeight(1f, searcher.CollectionStatistics("field"), searcher.TermStatistics(term, context)); var dummy = w.ValueForNormalization; // ignored w.Normalize(1F, 1F); Sims[(int)ord] = weight.Similarity.DoSimScorer(w, (AtomicReaderContext)reader.Context); } } }
private void AssertEquals(int maxDoc, SortedSetDocValues expected, SortedSetDocValues actual) { // can be null for the segment if no docs actually had any SortedDocValues // in this case FC.getDocTermsOrds returns EMPTY if (actual == null) { Assert.AreEqual(DocValues.EMPTY_SORTED_SET, expected); return; } Assert.AreEqual(expected.ValueCount, actual.ValueCount); // compare ord lists for (int i = 0; i < maxDoc; i++) { expected.Document = i; actual.Document = i; long expectedOrd; while ((expectedOrd = expected.NextOrd()) != SortedSetDocValues.NO_MORE_ORDS) { Assert.AreEqual(expectedOrd, actual.NextOrd()); } Assert.AreEqual(SortedSetDocValues.NO_MORE_ORDS, actual.NextOrd()); } // compare ord dictionary BytesRef expectedBytes = new BytesRef(); BytesRef actualBytes = new BytesRef(); for (long i = 0; i < expected.ValueCount; i++) { expected.LookupTerm(expectedBytes); actual.LookupTerm(actualBytes); Assert.AreEqual(expectedBytes, actualBytes); } // compare termsenum AssertEquals(expected.ValueCount, expected.TermsEnum(), actual.TermsEnum()); }