Package org.apache.lucene.analysis

Examples of org.apache.lucene.analysis.Token.termLength()


    TokenStream stream = new IterTokenStream("Kuczewski");
    TokenStream filter = new DoubleMetaphoneFilter(stream, 4, false);

    Token token = filter.next(new Token());
    assertEquals(4, token.termLength());
    assertEquals("KSSK", new String(token.termBuffer(), 0, token.termLength()));

    token = filter.next(new Token());
    assertEquals(4, token.termLength());
    assertEquals("KXFS", new String(token.termBuffer(), 0, token.termLength()));
    assertNull(filter.next(new Token()));
View Full Code Here


    Token token = filter.next(new Token());
    assertEquals(4, token.termLength());
    assertEquals("KSSK", new String(token.termBuffer(), 0, token.termLength()));

    token = filter.next(new Token());
    assertEquals(4, token.termLength());
    assertEquals("KXFS", new String(token.termBuffer(), 0, token.termLength()));
    assertNull(filter.next(new Token()));
  }

  public void testSize8FalseInject() throws Exception {
View Full Code Here

    assertEquals(4, token.termLength());
    assertEquals("KSSK", new String(token.termBuffer(), 0, token.termLength()));

    token = filter.next(new Token());
    assertEquals(4, token.termLength());
    assertEquals("KXFS", new String(token.termBuffer(), 0, token.termLength()));
    assertNull(filter.next(new Token()));
  }

  public void testSize8FalseInject() throws Exception {
    TokenStream stream = new IterTokenStream("international");
View Full Code Here

  public void testSize8FalseInject() throws Exception {
    TokenStream stream = new IterTokenStream("international");
    TokenStream filter = new DoubleMetaphoneFilter(stream, 8, false);

    Token token = filter.next(new Token());
    assertEquals(8, token.termLength());
    assertEquals("ANTRNXNL", new String(token.termBuffer(), 0, token
        .termLength()));

    assertNull(filter.next(new Token()));
  }
View Full Code Here

    TokenStream stream = new IterTokenStream("international");
    TokenStream filter = new DoubleMetaphoneFilter(stream, 8, false);

    Token token = filter.next(new Token());
    assertEquals(8, token.termLength());
    assertEquals("ANTRNXNL", new String(token.termBuffer(), 0, token
        .termLength()));

    assertNull(filter.next(new Token()));
  }
View Full Code Here

    TokenStream stream = new IterTokenStream(
        new String[] { "12345", "#$%@#^%&" });
    TokenStream filter = new DoubleMetaphoneFilter(stream, 8, true);

    Token token = filter.next(new Token());
    assertEquals(5, token.termLength());
    assertEquals("12345", new String(token.termBuffer(), 0, token.termLength()));

    token = filter.next(new Token());
    assertEquals(8, token.termLength());
    assertEquals("#$%@#^%&", new String(token.termBuffer(), 0, token
View Full Code Here

        new String[] { "12345", "#$%@#^%&" });
    TokenStream filter = new DoubleMetaphoneFilter(stream, 8, true);

    Token token = filter.next(new Token());
    assertEquals(5, token.termLength());
    assertEquals("12345", new String(token.termBuffer(), 0, token.termLength()));

    token = filter.next(new Token());
    assertEquals(8, token.termLength());
    assertEquals("#$%@#^%&", new String(token.termBuffer(), 0, token
        .termLength()));
View Full Code Here

    Token token = filter.next(new Token());
    assertEquals(5, token.termLength());
    assertEquals("12345", new String(token.termBuffer(), 0, token.termLength()));

    token = filter.next(new Token());
    assertEquals(8, token.termLength());
    assertEquals("#$%@#^%&", new String(token.termBuffer(), 0, token
        .termLength()));
  }

  public void testNonConvertableStringsWithoutInject() throws Exception {
View Full Code Here

    assertEquals(5, token.termLength());
    assertEquals("12345", new String(token.termBuffer(), 0, token.termLength()));

    token = filter.next(new Token());
    assertEquals(8, token.termLength());
    assertEquals("#$%@#^%&", new String(token.termBuffer(), 0, token
        .termLength()));
  }

  public void testNonConvertableStringsWithoutInject() throws Exception {
    TokenStream stream = new IterTokenStream(
View Full Code Here

    TokenStream filteredStream = factory.create(inputStream);

    assertEquals(DoubleMetaphoneFilter.class, filteredStream.getClass());

    Token token = filteredStream.next(new Token());
    assertEquals(13, token.termLength());
    assertEquals("international", new String(token.termBuffer(), 0, token
        .termLength()));

    token = filteredStream.next(new Token());
    assertEquals(4, token.termLength());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.