Package org.apache.lucene.analysis
Class MockCharFilter
- java.lang.Object
-
- java.io.Reader
-
- org.apache.lucene.analysis.CharStream
-
- org.apache.lucene.analysis.MockCharFilter
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Readable
public class MockCharFilter extends CharStream
the purpose of this charfilter is to send offsets out of bounds if the analyzer doesn't use correctOffset or does incorrect offset math.
-
-
Constructor Summary
Constructors Constructor Description MockCharFilter(Reader in)
MockCharFilter(Reader in, int remainder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addOffCorrectMap(int off, int cumulativeDiff)
void
close()
int
correctOffset(int currentOff)
Called by CharFilter(s) and Tokenizer to correct token offset.int
read()
int
read(char[] cbuf, int off, int len)
-
Methods inherited from class java.io.Reader
mark, markSupported, nullReader, read, read, ready, reset, skip, transferTo
-
-
-
-
Method Detail
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classReader
- Throws:
IOException
-
read
public int read() throws IOException
- Overrides:
read
in classReader
- Throws:
IOException
-
read
public int read(char[] cbuf, int off, int len) throws IOException
- Specified by:
read
in classReader
- Throws:
IOException
-
correctOffset
public int correctOffset(int currentOff)
Description copied from class:CharStream
Called by CharFilter(s) and Tokenizer to correct token offset.- Specified by:
correctOffset
in classCharStream
- Parameters:
currentOff
- offset as seen in the output- Returns:
- corrected offset based on the input
-
addOffCorrectMap
protected void addOffCorrectMap(int off, int cumulativeDiff)
-
-