/** Determine the current document number. Initially invalid, until {@link #next()} is called the first time. * @return the document number of the currently generated document */ public int doc() { return ((Scorer) subScorers.get(0)).doc(); }
/** Determine the current document number. Initially invalid, until {@link #next()} is called the first time. * @return the document number of the currently generated document */ public int doc() { return ((Scorer) subScorers.get(0)).doc(); }
private boolean doNext() throws IOException { int first=0; Scorer lastScorer = scorers[scorers.length-1]; Scorer firstScorer; while (more && (firstScorer=scorers[first]).doc() < (lastDoc=lastScorer.doc())) { more = firstScorer.skipTo(lastDoc); lastScorer = firstScorer; first = (first == (scorers.length-1)) ? 0 : first+1; } return more; }
private boolean doNext() throws IOException { int first=0; Scorer lastScorer = scorers[scorers.length-1]; Scorer firstScorer; while (more && (firstScorer=scorers[first]).doc() < (lastDoc=lastScorer.doc())) { more = firstScorer.skipTo(lastDoc); lastScorer = firstScorer; first = (first == (scorers.length-1)) ? 0 : first+1; } return more; }
private boolean checkAdjustElsePop(boolean cond) { if (cond) { // see also adjustTop topHSD.doc = topHSD.scorer.doc(); } else { // see also popNoResult heap[1] = heap[size]; // move last to first heap[size] = null; size--; } downHeap(); return cond; }
private boolean checkAdjustElsePop(boolean cond) { if (cond) { // see also adjustTop topHSD.doc = topHSD.scorer.doc(); } else { // see also popNoResult heap[1] = heap[size]; // move last to first heap[size] = null; size--; } downHeap(); return cond; }
private void scoreAll(int root, int size, int doc, float[] sum, float[] max) throws IOException { if (root<size && ((Scorer) subScorers.get(root)).doc() == doc) { float sub = ((Scorer) subScorers.get(root)).score(); sum[0] += sub; max[0] = Math.max(max[0], sub); scoreAll((root<<1)+1, size, doc, sum, max); scoreAll((root<<1)+2, size, doc, sum, max); } }
/** Determine the current document score. Initially invalid, until {@link #next()} is called the first time. * @return the score of the current generated document */ public float score() throws IOException { int doc = ((Scorer) subScorers.get(0)).doc(); float[] sum = {((Scorer) subScorers.get(0)).score()}, max = {sum[0]}; int size = subScorers.size(); scoreAll(1, size, doc, sum, max); scoreAll(2, size, doc, sum, max); return max[0] + (sum[0] - max[0])*tieBreakerMultiplier; }
private void scoreAll(int root, int size, int doc, float[] sum, float[] max) throws IOException { if (root<size && ((Scorer) subScorers.get(root)).doc() == doc) { float sub = ((Scorer) subScorers.get(root)).score(); sum[0] += sub; max[0] = Math.max(max[0], sub); scoreAll((root<<1)+1, size, doc, sum, max); scoreAll((root<<1)+2, size, doc, sum, max); } }
/** Determine the current document score. Initially invalid, until {@link #next()} is called the first time. * @return the score of the current generated document */ public float score() throws IOException { int doc = ((Scorer) subScorers.get(0)).doc(); float[] sum = {((Scorer) subScorers.get(0)).score()}, max = {sum[0]}; int size = subScorers.size(); scoreAll(1, size, doc, sum, max); scoreAll(2, size, doc, sum, max); return max[0] + (sum[0] - max[0])*tieBreakerMultiplier; }
public boolean skipTo(int target) throws IOException { boolean hasNext = subQueryScorer.skipTo(target); if(hasNext) { for(int i = 0; i < valSrcScorers.length; i++) { valSrcScorers[i].skipTo(subQueryScorer.doc()); } } return hasNext; }
public boolean skipTo(int target) throws IOException { boolean hasNext = subQueryScorer.skipTo(target); if(hasNext) { for(int i = 0; i < valSrcScorers.length; i++) { valSrcScorers[i].skipTo(subQueryScorer.doc()); } } return hasNext; }
public boolean next() throws IOException { boolean hasNext = subQueryScorer.next(); if(hasNext) { for(int i = 0; i < valSrcScorers.length; i++) { valSrcScorers[i].skipTo(subQueryScorer.doc()); } } return hasNext; }
public boolean next() throws IOException { boolean hasNext = subQueryScorer.next(); if(hasNext) { for(int i = 0; i < valSrcScorers.length; i++) { valSrcScorers[i].skipTo(subQueryScorer.doc()); } } return hasNext; }
/** Scores all documents and passes them to a collector. */ public void score(HitCollector hc) throws IOException { while (next()) { hc.collect(doc(), score()); } }
/** Scores and collects all matching documents. * @param hc The collector to which all matching documents are passed through * {@link HitCollector#collect(int, float)}. * <br>When this method is used the {@link #explain(int)} method should not be used. */ public void score(HitCollector hc) throws IOException { while (next()) { hc.collect(doc(), score()); } }
public float score() throws IOException { for(int i = 0; i < valSrcScorers.length; i++) { vScores[i] = valSrcScorers[i].score(); } return qWeight * customScore(subQueryScorer.doc(), subQueryScorer.score(), vScores); }
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; } }