@Override public void reset() throws IOException { super.reset(); tokenIter = null; } }
@Override public final void end() throws IOException { super.end(); }
/** * {@inheritDoc} */ @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (obj.getClass() != getClass()) { return false; } final TokenPairConcatenatingFilter rhs = (TokenPairConcatenatingFilter) obj; return new EqualsBuilder() .appendSuper(super.equals(obj)) .append(addSingleTerm, rhs.addSingleTerm) .append(previousWord, rhs.previousWord) .append(termAtt, rhs.termAtt) .isEquals(); } }
CharTermAttribute charTermAttribute = sf.addAttribute(CharTermAttribute.class); try { sf.reset(); while (sf.incrementToken()) { String token = charTermAttribute.toString().toLowerCase(); ngrams.add(token); sf.end(); sf.close(); } catch (IOException ex) {
private void assertURLDecodedTo(final Tokenizer t, final String uri, final String[] expectedStems, final String[] expectedTypes, final int[] expectedPosIncr) throws IOException { assertTrue("has CharTermAttribute", t.hasAttribute(CharTermAttribute.class)); final CharTermAttribute termAtt = t.getAttribute(CharTermAttribute.class); assertTrue("has TypeAttribute", t.hasAttribute(TypeAttribute.class)); final TypeAttribute typeAtt = t.getAttribute(TypeAttribute.class); assertTrue("has PositionIncrementAttribute", t.hasAttribute(PositionIncrementAttribute.class)); final PositionIncrementAttribute posIncrAtt = t.getAttribute(PositionIncrementAttribute.class); t.setReader(new StringReader(uri)); t.reset(); final TokenFilter filter = new MailtoFilter(t); for (int i = 0; i < expectedStems.length; i++) { assertTrue("token " + i + " exists", filter.incrementToken()); assertEquals(expectedStems[i], termAtt.toString()); if (expectedTypes == null) assertEquals(uritype, typeAtt.type()); else assertEquals(expectedTypes[i], typeAtt.type()); if (expectedPosIncr != null) assertEquals(expectedPosIncr[i], posIncrAtt.getPositionIncrement()); } filter.end(); filter.close(); }
@Override public void close() throws IOException { super.close(); this.delegate.close(); }
private void assertURLDecodedTo(final Tokenizer t, final String uri, final String[] expectedStems, final String[] expectedTypes, final int[] expectedPosIncr) throws IOException { assertTrue("has CharTermAttribute", t.hasAttribute(CharTermAttribute.class)); final CharTermAttribute termAtt = t.getAttribute(CharTermAttribute.class); assertTrue("has TypeAttribute", t.hasAttribute(TypeAttribute.class)); final TypeAttribute typeAtt = t.getAttribute(TypeAttribute.class); assertTrue("has PositionIncrementAttribute", t.hasAttribute(PositionIncrementAttribute.class)); final PositionIncrementAttribute posIncrAtt = t.getAttribute(PositionIncrementAttribute.class); t.setReader(new StringReader(uri)); t.reset(); final TokenFilter filter = new MailtoFilter(t); for (int i = 0; i < expectedStems.length; i++) { assertTrue("token " + i + " exists", filter.incrementToken()); assertEquals(expectedStems[i], termAtt.toString()); if (expectedTypes == null) assertEquals(uritype, typeAtt.type()); else assertEquals(expectedTypes[i], typeAtt.type()); if (expectedPosIncr != null) assertEquals(expectedPosIncr[i], posIncrAtt.getPositionIncrement()); } filter.end(); filter.close(); }
@Override public void close() throws IOException { super.close(); }
@Override public void reset() throws IOException { super.reset(); skippedPositions = 0; }
@Override public void end() throws IOException { super.end(); posIncrAtt.setPositionIncrement(posIncrAtt.getPositionIncrement() + skippedPositions); } }
public void close() throws IOException { super.close(); tokenQueue.clear(); }
@Override public boolean equals(Object obj) { return super.equals(obj); }
/** * {@inheritDoc} */ @Override public void reset() throws IOException { super.reset(); tokens.clear(); }
@Override public void end() throws IOException { super.end(); posIncrAtt.setPositionIncrement(curPosIncr); } }
public void close() throws IOException { super.close(); tokenQueue.clear(); }
@Override public boolean equals(Object obj) { return obj != null && getClass().equals( obj.getClass() ) && normalizerName.equals( ( (HibernateSearchNormalizerCheckingFilter) obj ).normalizerName ) && super.equals( obj ); }
@Override public void reset() throws IOException { super.reset(); this.done = true; resetVariable(); }
@Override public void end() throws IOException { super.end(); fixOffsets(); }
public void close() throws IOException { super.close(); tokenQueue.clear(); }
/** * {@inheritDoc} */ @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (obj.getClass() != getClass()) { return false; } final TokenPairConcatenatingFilter rhs = (TokenPairConcatenatingFilter) obj; return new EqualsBuilder() .appendSuper(super.equals(obj)) .append(addSingleTerm, rhs.addSingleTerm) .append(previousWord, rhs.previousWord) .append(termAtt, rhs.termAtt) .isEquals(); } }