use of com.yahoo.search.result.HitGroup in project vespa by vespa-engine.
the class FillingTestCase method testFillingAPIConsistencyThreePhase.
public void testFillingAPIConsistencyThreePhase() {
HitGroup group = new HitGroup();
group.add(createNonFilled("hit:1"));
group.add(createNonFilled("hit:2"));
assertFalse(group.isFilled("summary"));
assertFalse(group.isFilled("otherSummary"));
fillHitsIn(group, "otherSummary");
group.analyze();
assertFalse(group.isFilled("summary"));
assertTrue(group.isFilled("otherSummary"));
fillHitsIn(group, "summary");
assertTrue(group.isFilled("otherSummary"));
group.analyze();
// consistent again
assertTrue(group.isFilled("summary"));
assertTrue(group.isFilled("otherSummary"));
}
use of com.yahoo.search.result.HitGroup in project vespa by vespa-engine.
the class FillingTestCase method testFillingAPIConsistencyTwoPhase.
public void testFillingAPIConsistencyTwoPhase() {
HitGroup group = new HitGroup();
group.add(createNonFilled("hit:1"));
group.add(createNonFilled("hit:2"));
assertFalse(group.isFilled("summary"));
fillHitsIn(group, "summary");
group.analyze();
// consistent again
assertTrue(group.isFilled("summary"));
}
use of com.yahoo.search.result.HitGroup in project vespa by vespa-engine.
the class ResultBenchmark method createResult.
private final Result createResult() {
// 8 sets, 8 gets
Result result = new Result(new Query("?query=test&hits=10&presentation.bolding=true&model.type=all"));
addHits(5, "firstTopLevel", result.hits());
result.hits().add(addHits(10, "group1hit", new HitGroup()));
addHits(5, "secondTopLevel", result.hits());
result.hits().add(addHits(10, "group2hit", new HitGroup()));
result.hits().add(addHits(10, "group3hit", new HitGroup()));
return result;
}
use of com.yahoo.search.result.HitGroup in project vespa by vespa-engine.
the class FederationSearcher method mergeResult.
private void mergeResult(Query query, Target target, Result mergedResults, Result result) {
target.modifyTargetResult(result);
ComponentId searchChainId = target.getId();
Chain<Searcher> searchChain = target.getChain();
mergedResults.mergeWith(result);
HitGroup group = result.hits();
group.setId("source:" + searchChainId.getName());
group.setSearcherSpecificMetaData(this, searchChain);
// Set hit groups as non-meta as a default
group.setMeta(false);
// Set hit group as auxiliary so that it doesn't contribute to count
group.setAuxiliary(true);
group.setSource(searchChainId.getName());
group.setQuery(result.getQuery());
for (Iterator<Hit> it = group.unorderedDeepIterator(); it.hasNext(); ) {
Hit hit = it.next();
hit.setSearcherSpecificMetaData(this, searchChain);
hit.setSource(searchChainId.stringValue());
// See HTTPBackendSearcher, where this hit is created
if (hit.isMeta() && hit.types().contains("logging")) {
// Augment this hit with count fields
hit.setField(LOG_COUNT_PREFIX + "deep", result.getDeepHitCount());
hit.setField(LOG_COUNT_PREFIX + "total", result.getTotalHitCount());
int offset = result.getQuery().getOffset();
hit.setField(LOG_COUNT_PREFIX + "first", offset + 1);
hit.setField(LOG_COUNT_PREFIX + "last", result.getConcreteHitCount() + offset);
}
}
if (query.getTraceLevel() >= 4)
query.trace("Got " + group.getConcreteSize() + " hits from " + group.getId(), false, 4);
mergedResults.hits().add(group);
}
use of com.yahoo.search.result.HitGroup in project vespa by vespa-engine.
the class GetSearcherTestCase method testQueryPassThrough.
/* Test that a query without any ids is passed through to the next chain */
@Test
public void testQueryPassThrough() throws Exception {
DocumentSessionFactory factory = new DocumentSessionFactory(docType);
GetSearcher searcher = new GetSearcher(new FeedContext(new MessagePropertyProcessor(defFeedCfg, defLoadTypeCfg), factory, docMan, new ClusterList(), new NullFeedMetric()));
HitGroup hits = new HitGroup("mock");
hits.add(new Hit("blernsball"));
Chain<Searcher> searchChain = new Chain<>(searcher, new MockBackend(hits));
Result result = new Execution(searchChain, Execution.Context.createContextStub()).search(newQuery("?flarn=blern"));
assertEquals(0, factory.messages.size());
assertEquals(1, result.hits().size());
assertNotNull(result.hits().get("blernsball"));
}
Aggregations