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));
        }
        private ISearchQuery CompileWord(WordAstQuery wordQuery)
        {
            var matcher     = new DfaTermMatcher(new SequenceMatcher <char>(wordQuery.Value, false));
            var postingList = index.GetTerms(matcher).Select(p => index.PostingLists.Get(p.Value)).SingleOrDefault();

            if (postingList == null)
            {
                return(NullQuery.Instance);
            }

            return(new TermQuery(postingList));
        }
        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;
                }
            }
        }
        public static IEnumerable <DictionaryTerm> GetTerms(this IFullTextIndex index, string word, int distance)
        {
            var matcher = new DfaTermMatcher(new LevenshteinMatcher(word, distance));

            return(index.GetTerms(matcher));
        }
        public static IEnumerable <DictionaryTerm> GetTerms(this IFullTextIndex index, string wildcardPattern)
        {
            var matcher = new DfaTermMatcher(new WildcardMatcher(wildcardPattern, index.Header.MaxTokenSize));

            return(index.GetTerms(matcher));
        }