use of com.yahoo.prelude.fastsearch.FastHit in project vespa by vespa-engine.
the class GetDocSumsPacket method setFieldsFromHits.
private void setFieldsFromHits() {
for (Iterator<Hit> i = result.hits().unorderedDeepIterator(); i.hasNext(); ) {
Hit h = i.next();
if (h instanceof FastHit) {
FastHit hit = (FastHit) h;
if (hit.shouldIgnoreRowBits()) {
flags |= GDFLAG_IGNORE_ROW;
}
QueryPacketData tag = hit.getQueryPacketData();
if (tag != null) {
this.queryPacketData = tag;
break;
}
}
}
}
use of com.yahoo.prelude.fastsearch.FastHit in project vespa by vespa-engine.
the class GetDocSumsPacket method encodeDocIds.
private void encodeDocIds(ByteBuffer buffer) {
byte[] emptyGid = new byte[GlobalId.LENGTH];
for (Iterator<Hit> i = result.hits().unorderedDeepIterator(); i.hasNext(); ) {
Hit hit = i.next();
if (hit instanceof FastHit && !hit.isFilled(summaryClass)) {
FastHit fastHit = (FastHit) hit;
buffer.put(fastHit.getGlobalId() != null ? fastHit.getGlobalId().getRawId() : emptyGid);
buffer.putInt(fastHit.getPartId());
// Unused, was docstamp
buffer.putInt(0);
}
}
}
use of com.yahoo.prelude.fastsearch.FastHit in project vespa by vespa-engine.
the class JuniperSearcher method highlight.
private void highlight(boolean bolding, Iterator<Hit> hitsToHighlight, String summaryClass, IndexFacts.Session indexFacts) {
while (hitsToHighlight.hasNext()) {
Hit sniffHit = hitsToHighlight.next();
if (!(sniffHit instanceof FastHit))
continue;
FastHit hit = (FastHit) sniffHit;
if (summaryClass != null && !hit.isFilled(summaryClass))
continue;
Object searchDefinitionField = hit.getField(MAGIC_FIELD);
if (searchDefinitionField == null)
continue;
String searchDefinitionName = searchDefinitionField.toString();
for (String fieldName : hit.fields().keySet()) {
Index index = indexFacts.getIndex(fieldName, searchDefinitionName);
if (index.getDynamicSummary() || index.getHighlightSummary())
insertTags(hit.buildHitField(fieldName, true, true), bolding, index.getDynamicSummary());
}
}
}
use of com.yahoo.prelude.fastsearch.FastHit 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.prelude.fastsearch.FastHit in project vespa by vespa-engine.
the class Dispatcher method hitsByNode.
/**
* Return a map of hits by their search node (partition) id
*/
private static ListMap<Integer, FastHit> hitsByNode(Result result) {
ListMap<Integer, FastHit> hitsByPartition = new ListMap<>();
for (Iterator<Hit> i = result.hits().unorderedDeepIterator(); i.hasNext(); ) {
Hit h = i.next();
if (!(h instanceof FastHit))
continue;
FastHit hit = (FastHit) h;
hitsByPartition.put(hit.getDistributionKey(), hit);
}
return hitsByPartition;
}
Aggregations