use of com.yahoo.search.result.Hit in project vespa by vespa-engine.
the class SecondSearcher method search.
public Result search(com.yahoo.search.Query query, Execution execution) {
Result result = execution.search(query);
result.hits().add(new Hit("searcher:2", 996));
return result;
}
use of com.yahoo.search.result.Hit in project vespa by vespa-engine.
the class HttpTestCase method test_that_ip_address_set_on_meta_hit.
public void test_that_ip_address_set_on_meta_hit() {
Result result = searchUsingLocalhost();
Hit metaHit = getFirstMetaHit(result.hits());
String ip = (String) metaHit.getField(HTTPSearcher.LOG_IP_ADDRESS);
assertEquals(ip, "127.0.0.1");
}
use of com.yahoo.search.result.Hit in project vespa by vespa-engine.
the class DummySearcher method search.
public Result search(com.yahoo.search.Query query, Execution execution) {
Result result = new Result(query);
result.hits().add(new Hit("http://a.com/b", 100));
return result;
}
use of com.yahoo.search.result.Hit in project vespa by vespa-engine.
the class QuerySnapshotSearcherTestCase method test.
public void test() {
Searcher searcher = new QuerySnapshotSearcher();
Result result = doSearch(searcher, new Query(), 0, 10);
Hit hit = result.hits().get(0);
assertEquals(String.valueOf(Double.POSITIVE_INFINITY), hit.getRelevance().toString());
}
use of com.yahoo.search.result.Hit in project vespa by vespa-engine.
the class QuotingSearcherTestCase method testBasicQuotingWithNoisyStrings.
public void testBasicQuotingWithNoisyStrings() {
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", "&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