use of com.yahoo.search.result.Relevance in project vespa by vespa-engine.
the class UniqueGroupingSearcherTestCase method makeHitGroup.
private static Group makeHitGroup(String name) {
Group ein = new Group(new StringId(name), new Relevance(0));
HitList hits = new HitList(UniqueGroupingSearcher.LABEL_HITS);
hits.add(new Hit(name));
ein.add(hits);
return ein;
}
use of com.yahoo.search.result.Relevance in project vespa by vespa-engine.
the class UniqueGroupingSearcherTestCase method makeSortingHitGroup.
private static Group makeSortingHitGroup(String name) {
Hit hit = new Hit(name);
HitList hits = new HitList(UniqueGroupingSearcher.LABEL_HITS);
hits.add(hit);
Group dedupGroup = new Group(new StringId(name), new Relevance(0));
dedupGroup.add(hits);
GroupList dedupedHits = new GroupList(UniqueGroupingSearcher.LABEL_GROUPS);
dedupedHits.add(dedupGroup);
Group ein = new Group(new StringId(name), new Relevance(0));
ein.add(dedupedHits);
return ein;
}
use of com.yahoo.search.result.Relevance in project vespa by vespa-engine.
the class JSONDebugSearcherTestCase method addResult.
private void addResult(Query q, String content, DocumentSourceSearcher docsource) {
Result r = new Result(q);
FastHit hit = new FastHit();
hit.setId("http://abc.html");
hit.setRelevance(new Relevance(1));
hit.setField("jsonfield", new JSONString(content));
r.hits().add(hit);
docsource.addResult(q, r);
}
use of com.yahoo.search.result.Relevance 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"));
}
use of com.yahoo.search.result.Relevance in project vespa by vespa-engine.
the class QuotingSearcherTestCase method testNoQuotingWithOtherTypes.
public void testNoQuotingWithOtherTypes() {
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 Integer(42));
r.hits().add(hit);
docsource.addResultSet(q, r);
Result check = doSearch(s, q, 0, 10, chained);
// should not quote non-string properties
assertEquals(new Integer(42), check.hits().get(0).getField("title"));
}
Aggregations