Search in sources :

Example 1 with NanNumber

use of com.yahoo.search.result.NanNumber in project vespa by vespa-engine.

the class JsonRenderer method shouldRender.

private boolean shouldRender(String fieldName, Hit hit) {
    if (debugRendering)
        return true;
    if (fieldName.startsWith(VESPA_HIDDEN_FIELD_PREFIX))
        return false;
    RenderDecision r = lazyRenderAwareCheck(fieldName, hit);
    if (r != RenderDecision.DO_NOT_KNOW)
        return r.booleanValue();
    // this will trigger field decoding, so it is important the lazy decoding magic is done first
    Object field = hit.getField(fieldName);
    if (field instanceof CharSequence && ((CharSequence) field).length() == 0)
        return false;
    // StringFieldValue cannot hold a null, so checking length directly is OK:
    if (field instanceof StringFieldValue && ((StringFieldValue) field).getString().isEmpty())
        return false;
    if (field instanceof NanNumber)
        return false;
    return true;
}
Also used : NanNumber(com.yahoo.search.result.NanNumber) StringFieldValue(com.yahoo.document.datatypes.StringFieldValue) JSONObject(org.json.JSONObject)

Aggregations

StringFieldValue (com.yahoo.document.datatypes.StringFieldValue)1 NanNumber (com.yahoo.search.result.NanNumber)1 JSONObject (org.json.JSONObject)1