use of com.yahoo.prelude.hitfield.HitField in project vespa by vespa-engine.
the class HitFieldTestCase method testEmptyField.
@Test
public void testEmptyField() {
HitField hf = new HitField("boo", "");
assertEquals(0, hf.getTokenizedContent().size());
}
use of com.yahoo.prelude.hitfield.HitField in project vespa by vespa-engine.
the class QuotingSearcherTestCase method testFieldQuotingWithNoisyStrings.
public void testFieldQuotingWithNoisyStrings() {
Map<Searcher, Searcher> chained = new HashMap<>();
Searcher s = createQuotingSearcher("file:src/test/java/com/yahoo/prelude/" + "searcher/test/testquoting.cfg");
DocumentSourceSearcher docsource = new DocumentSourceSearcher();
chained.put(s, docsource);
Query q = new Query("?query=a");
Result r = new Result(q);
Hit hit = new FastHit();
hit.setId("http://abc.html");
hit.setRelevance(new Relevance(1));
hit.setField("title", new HitField("title", "&smith &jo& nes"));
r.hits().add(hit);
docsource.addResultSet(q, r);
Result check = doSearch(s, q, 0, 10, chained);
assertEquals("&smith &jo& nes", check.hits().get(0).getField("title").toString());
assertTrue(check.hits().get(0).fields().containsKey("title"));
}
Aggregations