use of com.yahoo.search.Result in project vespa by vespa-engine.
the class DocumentSourceSearcher method search.
public Result search(com.yahoo.search.Query query, Execution execution) {
queryCount++;
Result r;
r = unFilledResults.get(getQueryKeyClone(query));
if (r == null) {
r = defaultFilledResult.clone();
} else {
r = r.clone();
}
r.setQuery(query);
r.hits().trim(query.getOffset(), query.getHits());
return r;
}
use of com.yahoo.search.Result in project vespa by vespa-engine.
the class JuniperSearcher method fill.
@Override
public void fill(Result result, String summaryClass, Execution execution) {
Result workResult = result;
final int worstCase = workResult.getHitCount();
final List<Hit> hits = new ArrayList<>(worstCase);
for (final Iterator<Hit> i = workResult.hits().deepIterator(); i.hasNext(); ) {
final Hit sniffHit = i.next();
if (!(sniffHit instanceof FastHit))
continue;
final FastHit hit = (FastHit) sniffHit;
if (hit.isFilled(summaryClass))
continue;
hits.add(hit);
}
execution.fill(workResult, summaryClass);
highlight(workResult.getQuery().getPresentation().getBolding(), hits.iterator(), summaryClass, execution.context().getIndexFacts().newSession(result.getQuery()));
}
use of com.yahoo.search.Result in project vespa by vespa-engine.
the class JuniperSearcher method search.
/**
* Convert Juniper style property highlighting to XML style.
*/
@Override
public Result search(Query query, Execution execution) {
Result result = execution.search(query);
highlight(query.getPresentation().getBolding(), result.hits().deepIterator(), null, execution.context().getIndexFacts().newSession(query));
return result;
}
use of com.yahoo.search.Result in project vespa by vespa-engine.
the class QueryValidatingSearcher method search.
public Result search(Query query, Execution execution) {
if (query.getHits() > 1000) {
Result result = new Result(query);
ErrorMessage error = ErrorMessage.createInvalidQueryParameter("Too many hits (more than 1000) requested.");
result.hits().addError(error);
return result;
}
if (query.getOffset() > 1000) {
Result result = new Result(query);
ErrorMessage error = ErrorMessage.createInvalidQueryParameter("Offset too high (above 1000).");
result.hits().addError(error);
return result;
}
return execution.search(query);
}
use of com.yahoo.search.Result in project vespa by vespa-engine.
the class ValidatePredicateSearcher method search.
@Override
public Result search(Query query, Execution execution) {
Optional<ErrorMessage> e = validate(query, execution.context().getIndexFacts().newSession(query));
if (e.isPresent()) {
Result r = new Result(query);
r.hits().addError(e.get());
return r;
}
return execution.search(query);
}
Aggregations