public override void VisitMatchingTerms(IndexReader reader, string fieldName, IMatchingTermVisitor mtv) { /* check term presence in index here for symmetry with other SimpleTerm's */ Terms terms = MultiFields.GetTerms(reader, fieldName); if (terms != null) { TermsEnum termsEnum = terms.Iterator(null); TermsEnum.SeekStatus status = termsEnum.SeekCeil(new BytesRef(TermText)); if (status == TermsEnum.SeekStatus.FOUND) { mtv.VisitMatchingTerm(GetLuceneTerm(fieldName)); } } }
public override void VisitMatchingTerms(IndexReader reader, string fieldName, IMatchingTermVisitor mtv) { /* inspired by PrefixQuery.rewrite(): */ Terms terms = MultiFields.GetTerms(reader, fieldName); if (terms != null) { TermsEnum termsEnum = terms.Iterator(null); bool skip = false; TermsEnum.SeekStatus status = termsEnum.SeekCeil(new BytesRef(Prefix)); if (status == TermsEnum.SeekStatus.FOUND) { mtv.VisitMatchingTerm(GetLucenePrefixTerm(fieldName)); } else if (status == TermsEnum.SeekStatus.NOT_FOUND) { if (StringHelper.StartsWith(termsEnum.Term(), prefixRef)) { mtv.VisitMatchingTerm(new Term(fieldName, termsEnum.Term().Utf8ToString())); } else { skip = true; } } else { // EOF skip = true; } if (!skip) { while (true) { BytesRef text = termsEnum.Next(); if (text != null && StringHelper.StartsWith(text, prefixRef)) { mtv.VisitMatchingTerm(new Term(fieldName, text.Utf8ToString())); } else { break; } } } } }
public override void VisitMatchingTerms(IndexReader reader, string fieldName, IMatchingTermVisitor mtv) { /* check term presence in index here for symmetry with other SimpleTerm's */ Terms terms = MultiFields.GetTerms(reader, fieldName); if (terms != null) { TermsEnum termsEnum = terms.GetEnumerator(); TermsEnum.SeekStatus status = termsEnum.SeekCeil(new BytesRef(TermText)); if (status == TermsEnum.SeekStatus.FOUND) { mtv.VisitMatchingTerm(GetLuceneTerm(fieldName)); } } }
public override void VisitMatchingTerms(IndexReader reader, string fieldName, IMatchingTermVisitor mtv) { /* inspired by PrefixQuery.rewrite(): */ Terms terms = MultiFields.GetTerms(reader, fieldName); if (terms != null) { TermsEnum termsEnum = terms.GetIterator(null); bool skip = false; TermsEnum.SeekStatus status = termsEnum.SeekCeil(new BytesRef(Prefix)); if (status == TermsEnum.SeekStatus.FOUND) { mtv.VisitMatchingTerm(GetLucenePrefixTerm(fieldName)); } else if (status == TermsEnum.SeekStatus.NOT_FOUND) { if (StringHelper.StartsWith(termsEnum.Term, prefixRef)) { mtv.VisitMatchingTerm(new Term(fieldName, termsEnum.Term.Utf8ToString())); } else { skip = true; } } else { // EOF skip = true; } if (!skip) { while (true) { BytesRef text = termsEnum.Next(); if (text != null && StringHelper.StartsWith(text, prefixRef)) { mtv.VisitMatchingTerm(new Term(fieldName, text.Utf8ToString())); } else { break; } } } } }
public abstract void VisitMatchingTerms( IndexReader reader, string fieldName, IMatchingTermVisitor mtv);