use of com.yahoo.prelude.hitfield.StringFieldPart in project vespa by vespa-engine.
the class TokenFieldIteratorTestCase method testTokenIteratorSet.
@Test
public void testTokenIteratorSet() {
HitField hf = new HitField("boo", "hei paa deg");
assertEquals(3, hf.getTokenizedContent().size());
ListIterator<FieldPart> l = hf.tokenIterator();
l.next();
l.next();
l.set(new StringFieldPart("aap", true));
l.next();
assertEquals(false, l.hasNext());
l.previous();
l.set(new StringFieldPart("ged", true));
assertEquals("hei aap ged", hf.getContent());
}
use of com.yahoo.prelude.hitfield.StringFieldPart in project vespa by vespa-engine.
the class HitFieldTestCase method testHitField.
@Test
public void testHitField() {
HitField hf = new HitField("boo", "hei paa deg");
assertEquals(3, hf.getTokenizedContent().size());
List l = new ArrayList();
l.add(new StringFieldPart("foo", true));
l.add(new StringFieldPart(" ", false));
l.add(new StringFieldPart("bar", true));
hf.setTokenizedContent(l);
assertEquals("foo bar", hf.getContent());
assertEquals("hei paa deg", hf.getRawContent());
}
use of com.yahoo.prelude.hitfield.StringFieldPart in project vespa by vespa-engine.
the class HitFieldTestCase method testCjk.
@Test
public void testCjk() {
HitField hf = new HitField("boo", "hmm\u001fgr");
assertEquals(2, hf.getTokenizedContent().size());
assertEquals("hmmgr", hf.getContent());
List l = new ArrayList();
l.add(new StringFieldPart("foo", true));
l.add(new StringFieldPart("bar", true));
hf.setTokenizedContent(l);
assertEquals("foobar", hf.getContent());
}
Aggregations