public TextReader GetText(ulong docId, ulong fieldId) { var key = GetKeyForPositions('T', docId, fieldId); var matcher = new DfaTermMatcher(new SequenceMatcher <char>(key, false)); var term = PosIndex.GetTerms(matcher).Single(); return(PositionsReader.GetText(term.Value.Offset)); }
public IEnumerable <TextPosition> GetPositions(ulong docId, ulong fieldId) { var key = GetKeyForPositions('P', docId, fieldId); var matcher = new DfaTermMatcher(new SequenceMatcher <char>(key, false)); var term = PosIndex.GetTerms(matcher).Single(); var offset = -1; foreach (var pos in PositionsReader.Get(term.Value.Offset)) { if (offset == -1) { offset = (int)pos; } else { yield return(TextPosition.P(offset - 1, (int)pos - offset)); offset = -1; } } }