use of com.yahoo.prelude.fastsearch.FastHit in project vespa by vespa-engine.
the class SyncDefaultRenderer method renderFieldContentPossiblyNotDecoded.
private void renderFieldContentPossiblyNotDecoded(XMLWriter writer, Hit hit, boolean probablyNotDecoded, String fieldName) throws IOException {
boolean dumpedRaw = false;
if (probablyNotDecoded && (hit instanceof FastHit)) {
writer.closeStartTag();
if ((writer.getWriter() instanceof ByteWriter) && context.isUtf8Output()) {
dumpedRaw = UserTemplate.dumpBytes((ByteWriter) writer.getWriter(), (FastHit) hit, fieldName);
}
if (dumpedRaw) {
// let the xml writer note that this tag had content
writer.content("", false);
}
}
if (!dumpedRaw) {
String xmlval = hit.getFieldXML(fieldName);
if (xmlval == null) {
xmlval = "(null)";
}
writer.escapedContent(xmlval, false);
}
}
use of com.yahoo.prelude.fastsearch.FastHit in project vespa by vespa-engine.
the class SyncDefaultRenderer method renderField.
private void renderField(XMLWriter writer, Hit hit, Iterator<Map.Entry<String, Object>> it) throws IOException {
Map.Entry<String, Object> entry = it.next();
boolean isProbablyNotDecoded = false;
if (hit instanceof FastHit) {
FastHit f = (FastHit) hit;
isProbablyNotDecoded = f.fieldIsNotDecoded(entry.getKey());
}
renderGenericFieldPossiblyNotDecoded(writer, hit, entry, isProbablyNotDecoded);
}
use of com.yahoo.prelude.fastsearch.FastHit in project vespa by vespa-engine.
the class DefaultRenderer method renderFieldContentPossiblyNotDecoded.
private void renderFieldContentPossiblyNotDecoded(XMLWriter writer, Hit hit, boolean probablyNotDecoded, String fieldName) throws IOException {
boolean dumpedRaw = false;
if (probablyNotDecoded && (hit instanceof FastHit)) {
writer.closeStartTag();
if ((writer.getWriter() instanceof ByteWriter) && utf8Output) {
dumpedRaw = UserTemplate.dumpBytes((ByteWriter) writer.getWriter(), (FastHit) hit, fieldName);
}
if (dumpedRaw) {
// let the xml writer note that this tag had content
writer.content("", false);
}
}
if (!dumpedRaw) {
String xmlval = hit.getFieldXML(fieldName);
if (xmlval == null) {
xmlval = "(null)";
}
writer.escapedContent(xmlval, false);
}
}
use of com.yahoo.prelude.fastsearch.FastHit in project vespa by vespa-engine.
the class HitConverter method convertVdsHit.
private Hit convertVdsHit(String summaryClass, VdsHit grpHit) {
FastHit ret = new FastHit();
ret.setRelevance(grpHit.getRank());
if (grpHit.getSummary().getData().length > 0) {
GroupingListHit ctxHit = (GroupingListHit) grpHit.getContext();
if (ctxHit == null) {
throw new NullPointerException("Hit has no context.");
}
DocsumDefinitionSet defs = ctxHit.getDocsumDefinitionSet();
defs.lazyDecode(summaryClass, grpHit.getSummary().getData(), ret);
ret.setFilled(summaryClass);
ret.setFilled(query.getPresentation().getSummary());
}
return ret;
}
use of com.yahoo.prelude.fastsearch.FastHit in project vespa by vespa-engine.
the class GetDocSumsPacketTestCase method testEncodingWithQuery.
@Test
public void testEncodingWithQuery() throws BufferTooSmallException {
FastHit hit = new FastHit();
hit.setIgnoreRowBits(true);
assertPacket(true, hit, new byte[] { 0, 0, 0, 57, 0, 0, 0, -37, 0, 0, 40, 21, 0, 0, 0, 0, IGNORE, IGNORE, IGNORE, IGNORE, 7, 100, 101, 102, 97, 117, 108, 116, 0, 0, 0, 0x03, 0, 0, 0, 7, 100, 101, 102, 97, 117, 108, 116, 0, 0, 0, 1, 0, 0, 0, 6, 4, 0, 3, 102, 111, 111, 0, 0, 0, 3 });
hit = new FastHit();
hit.setIgnoreRowBits(false);
assertPacket(true, hit, new byte[] { 0, 0, 0, 57, 0, 0, 0, -37, 0, 0, 40, 21, 0, 0, 0, 0, IGNORE, IGNORE, IGNORE, IGNORE, 7, 100, 101, 102, 97, 117, 108, 116, 0, 0, 0, 0x03, 0, 0, 0, 7, 100, 101, 102, 97, 117, 108, 116, 0, 0, 0, 1, 0, 0, 0, 6, 4, 0, 3, 102, 111, 111, 0, 0, 0, 2 });
}
Aggregations