Exemplo n.º 1
0
        public override bool IncrementToken()
        {
            // TODO: fix me when posInc=false, to work like FilteringTokenFilter in that case and not return
            // initial token with posInc=0 ever

            // return the first non-stop word found
            SkippedPositions = 0;
            while (input.IncrementToken())
            {
                if (!Filter.Run(TermAtt.Buffer(), 0, TermAtt.Length))
                {
                    PosIncrAtt.PositionIncrement = PosIncrAtt.PositionIncrement + SkippedPositions;
                    return(true);
                }
                SkippedPositions += PosIncrAtt.PositionIncrement;
            }
            // reached EOS -- return false
            return(false);
        }
Exemplo n.º 2
0
 protected override AcceptStatus Accept(BytesRef term)
 {
     UnicodeUtil.UTF8toUTF16(term.Bytes, term.Offset, term.Length, Utf16);
     return(RunAutomaton.Run(Utf16.Chars, 0, Utf16.Length) ? AcceptStatus.YES : AcceptStatus.NO);
 }