use of com.yahoo.prelude.hitfield.HitField in project vespa by vespa-engine.
the class QuotingSearcher method quoteProperty.
private void quoteProperty(Hit hit, String fieldname, String toQuote, QuoteTable translations) {
List<FieldPart> l = translate(toQuote, translations, true);
if (l != null) {
HitField hf = new HitField(fieldname, toQuote);
hf.setTokenizedContent(l);
hit.setField(fieldname, hf);
}
}
use of com.yahoo.prelude.hitfield.HitField 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.HitField in project vespa by vespa-engine.
the class TokenFieldIteratorTestCase method testTokenIteratorPrevious.
@Test
public void testTokenIteratorPrevious() {
HitField hf = new HitField("boo", "hei paa");
ListIterator<?> l = hf.tokenIterator();
FieldPart p = (FieldPart) l.next();
assertEquals("hei", p.getContent());
p = (FieldPart) l.next();
assertEquals("paa", p.getContent());
p = (FieldPart) l.previous();
assertEquals("paa", p.getContent());
p = (FieldPart) l.previous();
assertEquals("hei", p.getContent());
}
use of com.yahoo.prelude.hitfield.HitField 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.HitField 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