use of com.yahoo.language.Linguistics in project vespa by vespa-engine.
the class NGramTestCase method requireThatHashCodeAndEqualsAreImplemented.
@Test
public void requireThatHashCodeAndEqualsAreImplemented() {
Linguistics linguistics = new SimpleLinguistics();
NGramExpression exp = new NGramExpression(linguistics, 69);
assertFalse(exp.equals(new Object()));
assertFalse(exp.equals(new NGramExpression(Mockito.mock(Linguistics.class), 96)));
assertFalse(exp.equals(new NGramExpression(linguistics, 96)));
assertEquals(exp, new NGramExpression(linguistics, 69));
assertEquals(exp.hashCode(), new NGramExpression(new SimpleLinguistics(), 69).hashCode());
}
use of com.yahoo.language.Linguistics in project vespa by vespa-engine.
the class QueryTestCase method testUnicodeNormalization.
@Test
public void testUnicodeNormalization() {
Linguistics linguistics = new SimpleLinguistics();
Query query = newQueryFromEncoded("?query=content:%EF%BC%B3%EF%BC%AF%EF%BC%AE%EF%BC%B9", Language.ENGLISH, linguistics);
assertEquals("SONY", ((WordItem) query.getModel().getQueryTree().getRoot()).getWord());
query = newQueryFromEncoded("?query=foo&filter=+%EF%BC%B3%EF%BC%AF%EF%BC%AE%EF%BC%B9", Language.ENGLISH, linguistics);
assertEquals("RANK foo |SONY", query.getModel().getQueryTree().getRoot().toString());
query = newQueryFromEncoded("?query=foo+AND+%EF%BC%B3%EF%BC%AF%EF%BC%AE%EF%BC%B9)&type=adv", Language.ENGLISH, linguistics);
assertEquals("AND foo SONY", query.getModel().getQueryTree().getRoot().toString());
}
Aggregations