public Explanation explain(int doc) { Explanation e = new Explanation(); e.setDescription("No document matches."); return e; } }
public Explanation explain(int doc) { Explanation e = new Explanation(); e.setDescription("No document matches."); return e; } }
public Explanation explain(float... scores) { Explanation expl = new Explanation(); float boost = 1.0f; for (float score : scores) { boost *= score; } expl.setValue(boost); expl.setDescription("product of: " + Arrays.toString(scores)); return expl; } }
public Explanation explain(float... scores) { Explanation expl = new Explanation(); float sum = 0.0f; for (float score : scores) { sum += score; } expl.setValue(sum); expl.setDescription("sum of: " + Arrays.toString(scores)); return expl; } }
public Explanation explain(int doc) throws IOException { Explanation res = new Explanation(); if (exclScorer.skipTo(doc) && (exclScorer.doc() == doc)) { res.setDescription("excluded"); } else { res.setDescription("not excluded"); res.addDetail(reqScorer.explain(doc)); } return res; } }
public Explanation explain(int doc) throws IOException { Explanation res = new Explanation(); if (exclScorer.skipTo(doc) && (exclScorer.doc() == doc)) { res.setDescription("excluded"); } else { res.setDescription("not excluded"); res.addDetail(reqScorer.explain(doc)); } return res; } }
public static Explanation convertToExplanation(JSONObject jsonObj) throws JSONException { if (jsonObj == null) return null; Explanation explanation = new Explanation(); float value = (float) jsonObj.optDouble(SenseiSearchServletParams.PARAM_RESULT_HITS_EXPL_VALUE); String description = jsonObj.optString(SenseiSearchServletParams.PARAM_RESULT_HITS_EXPL_DESC); explanation.setDescription(description); explanation.setValue(value); if (jsonObj.has(SenseiSearchServletParams.PARAM_RESULT_HITS_EXPL_DETAILS)) { JSONArray detailsArr = jsonObj .getJSONArray(SenseiSearchServletParams.PARAM_RESULT_HITS_EXPL_DETAILS); int detailsCnt = detailsArr.length(); for (int i = 0; i < detailsCnt; i++) { JSONObject detailObj = (JSONObject) detailsArr.get(i); Explanation detailExpl = convertToExplanation(detailObj); explanation.addDetail(detailExpl); } } return explanation; }
public Explanation explain(int df, float boost) { Explanation expl = new Explanation(); expl.setValue(score(df, boost)); expl.setDescription("boost value of: " + boost); return expl; }
public Explanation explain(int df, float boost) { Explanation expl = new Explanation(); expl.setValue(score(df, boost)); expl.setDescription("facet boost value of: " + boost); return expl; }
@Override public Explanation explain(AtomicReaderContext context, int doc) throws IOException { Explanation result = new Explanation(); result.setValue(getBoost()); result.setDescription(SectionSearchQuery.this.toString()); return result; }
/** Explain the score of a document. * @todo Also show the total score. * See BooleanScorer.explain() on how to do this. */ public Explanation explain(int doc) throws IOException { Explanation res = new Explanation(); res.setDescription("required, optional"); res.addDetail(reqScorer.explain(doc)); res.addDetail(optScorer.explain(doc)); return res; } }
/** Explain the score of a document. * @todo Also show the total score. * See BooleanScorer.explain() on how to do this. */ public Explanation explain(int doc) throws IOException { Explanation res = new Explanation(); res.setDescription("required, optional"); res.addDetail(reqScorer.explain(doc)); res.addDetail(optScorer.explain(doc)); return res; } }
public Explanation explain(final int doc) throws IOException { Explanation result = new Explanation(); Explanation nonPayloadExpl = super.explain(doc); result.addDetail(nonPayloadExpl); //QUESTION: Is there a wau to avoid this skipTo call? We need to know whether to load the payload or not Explanation payloadBoost = new Explanation(); result.addDetail(payloadBoost); /* if (skipTo(doc) == true) { processPayload(); } */ float avgPayloadScore = (payloadsSeen > 0 ? (payloadScore / payloadsSeen) : 1); payloadBoost.setValue(avgPayloadScore); //GSI: I suppose we could toString the payload, but I don't think that would be a good idea payloadBoost.setDescription("scorePayload(...)"); result.setValue(nonPayloadExpl.getValue() * avgPayloadScore); result.setDescription("btq, product of:"); return result; } }
public Explanation explain(final int doc) throws IOException { Explanation tfExplanation = new Explanation(); skipTo(doc); float phraseFreq = (doc() == doc) ? freq : 0.0f; tfExplanation.setValue(getSimilarity().tf(phraseFreq)); tfExplanation.setDescription("tf(phraseFreq=" + phraseFreq + ")"); return tfExplanation; }
public Explanation explain(final int doc) throws IOException { Explanation tfExplanation = new Explanation(); skipTo(doc); float phraseFreq = (doc() == doc) ? freq : 0.0f; tfExplanation.setValue(getSimilarity().tf(phraseFreq)); tfExplanation.setDescription("tf(phraseFreq=" + phraseFreq + ")"); return tfExplanation; }
public Explanation explain(final int doc) throws IOException { Explanation tfExplanation = new Explanation(); skipTo(doc); float phraseFreq = (doc() == doc) ? freq : 0.0f; tfExplanation.setValue(getSimilarity().tf(phraseFreq)); tfExplanation.setDescription("tf(phraseFreq=" + phraseFreq + ")"); return tfExplanation; }
public Explanation explain(final int doc) throws IOException { Explanation tfExplanation = new Explanation(); while (next() && doc() < doc) {} float phraseFreq = (doc() == doc) ? freq : 0.0f; tfExplanation.setValue(getSimilarity().tf(phraseFreq)); tfExplanation.setDescription("tf(phraseFreq=" + phraseFreq + ")"); return tfExplanation; }
public Explanation explain(final int doc) throws IOException { Explanation tfExplanation = new Explanation(); while (next() && doc() < doc) {} float phraseFreq = (doc() == doc) ? freq : 0.0f; tfExplanation.setValue(getSimilarity().tf(phraseFreq)); tfExplanation.setDescription("tf(phraseFreq=" + phraseFreq + ")"); return tfExplanation; }
public Explanation explain(final int doc) throws IOException { Explanation tfExplanation = new Explanation(); while (next() && doc() < doc) {} float phraseFreq = (doc() == doc) ? freq : 0.0f; tfExplanation.setValue(getSimilarity().tf(phraseFreq)); tfExplanation.setDescription("tf(phraseFreq=" + phraseFreq + ")"); return tfExplanation; }
public Explanation explain(int doc) throws IOException { TermQuery query = (TermQuery)weight.getQuery(); Explanation tfExplanation = new Explanation(); int tf = 0; while (pointer < pointerMax) { if (docs[pointer] == doc) tf = freqs[pointer]; pointer++; } if (tf == 0) { while (termDocs.next()) { if (termDocs.doc() == doc) { tf = termDocs.freq(); } } } termDocs.close(); tfExplanation.setValue(getSimilarity().tf(tf)); tfExplanation.setDescription("tf(termFreq("+query.getTerm()+")="+tf+")"); return tfExplanation; }