@Override public int getDocumentLength() { return current.getDocumentLength(); }
@Override public int getFrequency() { return current.getFrequency(); }
@Override public int getId() { return current.getId(); }
assert postings[di][ti].getId() == docids[di] : "At position "+di+" in resultset, Posting id " + docids[di] + " for term "+ti+" was expected, found id " +postings[di][ti].getId()+ " with contents " + postings[di][ti].toString() ; assert postings[di][ti].getFrequency() > 0; final WritablePosting p = postings[di][ti]; final double s = wms[ti].score(p); System.err.println(wms[ti].getInfo() + " was "+s+": posting=(" + p.toString() + ") for term " + ti + " ks=" + keyFreqs[ti] + " es="+ entryStats[ti] + " l=" + p.getDocumentLength()); if (p instanceof FieldPosting) System.err.println("lf="+ Arrays.toString(((FieldPosting)p).getFieldLengths()));
p.readFields(in); assert docids[i] == p.getId() : "rank "+i+" of "+resultSize+", term "+j+" of "+termCount+" expected docid="+docids[i]+" found "+p.getId(); p.setDocumentLength(docLen); if (fields[j]) ((FieldPosting)p).setFieldLengths(fieldLens);
out.writeInt(firstPosting.getDocumentLength()); if (fieldCount > 0) p.write(out);
assertEquals(1, rs.getPostings().length); assertEquals(1, rs.getPostings()[0].length); assertEquals(20, rs.getPostings()[0][0].getId()); assertEquals(5, rs.getPostings()[0][0].getFrequency());
@Override protected void assignScore(final int i, final CandidateResult cc) throws IOException { //update the score as normal cc.updateScore(plm.score(i)); cc.updateOccurrence((i < 16) ? (short)(1 << i) : 0); //get a deep copy of the posting final Posting p = plm.getPosting(i); //writable postings don't copy or retain document length. Make this not so. final WritablePosting wp = p.asWritablePosting(); assert wp.getId() == cc.getDocId() : "Posting does not have same docid as candidate result"; wp.setDocumentLength(p.getDocumentLength()); if (fields[i]) { final int[] fieldLengths = ((FieldPosting)p).getFieldLengths(); final int[] newFieldLengths = new int[fieldCount]; System.arraycopy(fieldLengths, 0, newFieldLengths, 0, fieldCount); //System.err.println(fieldLengths); assert fieldLengths.length == super.collectionStatistics.getNumberOfFields() : " posting "+p +" for docid " + p.getId() + " has wrong number of fields for length"; ((FieldPosting)wp).setFieldLengths(newFieldLengths); } //store somewhere ((FatCandidateResult)cc).setPosting(i, wp); } }
@Override public WritablePosting asWritablePosting() { return current.asWritablePosting(); }
@Override public void setId(int id) { current.setId(id); }
assert postings[di][ti].getId() == docids[di] : "At position "+di+" in resultset, Posting id " + docids[di] + " for term "+ti+" was expected, found id " +postings[di][ti].getId()+ " with contents " + postings[di][ti].toString() ; assert postings[di][ti].getFrequency() > 0; final WritablePosting p = postings[di][ti]; final double s = wms[ti].score(p); System.err.println(wms[ti].getInfo() + " was "+s+": posting=(" + p.toString() + ") for term " + ti + " ks=" + keyFreqs[ti] + " es="+ entryStats[ti] + " l=" + p.getDocumentLength()); if (p instanceof FieldPosting) System.err.println("lf="+ Arrays.toString(((FieldPosting)p).getFieldLengths()));
p.readFields(in); assert docids[i] == p.getId() : "rank "+i+" of "+resultSize+", term "+j+" of "+termCount+" expected docid="+docids[i]+" found "+p.getId(); p.setDocumentLength(docLen); if (fields[j]) ((FieldPosting)p).setFieldLengths(fieldLens);
out.writeInt(firstPosting.getDocumentLength()); if (fieldCount > 0) p.write(out);
@Override protected void assignScore(final int i, final CandidateResult cc) throws IOException { //update the score as normal cc.updateScore(plm.score(i)); cc.updateOccurrence((i < 16) ? (short)(1 << i) : 0); //get a deep copy of the posting final Posting p = plm.getPosting(i); //writable postings don't copy or retain document length. Make this not so. final WritablePosting wp = p.asWritablePosting(); assert wp.getId() == cc.getDocId() : "Posting does not have same docid as candidate result"; wp.setDocumentLength(p.getDocumentLength()); if (fields[i]) { final int[] fieldLengths = ((FieldPosting)p).getFieldLengths(); final int[] newFieldLengths = new int[fieldCount]; System.arraycopy(fieldLengths, 0, newFieldLengths, 0, fieldCount); //System.err.println(fieldLengths); assert fieldLengths.length == super.collectionStatistics.getNumberOfFields() : " posting "+p +" for docid " + p.getId() + " has wrong number of fields for length"; ((FieldPosting)wp).setFieldLengths(newFieldLengths); } //store somewhere ((FatCandidateResult)cc).setPosting(i, wp); } }
@Override public WritablePosting asWritablePosting() { return current.asWritablePosting(); }
@Override public void setId(int id) { current.setId(id); }
System.out.println(frInput.getScores()[0]); assertTrue(frInput.getScores()[0] > 0); assertEquals(0, frInput.getPostings()[0][0].getId()); assertEquals(1, frInput.getPostings()[0][0].getFrequency()); assertEquals(8, frInput.getPostings()[0][0].getDocumentLength());
p.readFields(in); assert docids[i] == p.getId() : "rank "+i+" of "+resultSize+", term "+j+" of "+termCount+" expected docid="+docids[i]+" found "+p.getId(); p.setDocumentLength(docLen); if (fields[j]) ((FieldPosting)p).setFieldLengths(fieldLens);
out.writeInt(firstPosting.getDocumentLength()); if (fieldCount > 0) p.write(out);
@Override public int getId() { return current.getId(); }