assertThat(msv.get(1), closeTo(4, 1.0e-5));
}
@Test
public void testAddMultipleScores() {
ItemScorer scorer = PrecomputedItemScorer.newBuilder()
.addScore(42, 3, 4)
.addScore(42, 7, 2)
.build();
MutableSparseVector msv = MutableSparseVector.create(1, 3, 5, 7, 8);
scorer.score(42, msv);
assertThat(msv.keySet().size(), equalTo(2));
assertThat(msv.containsKey(1), equalTo(false));
assertThat(msv.containsKey(3), equalTo(true));
assertThat(msv.containsKey(5), equalTo(false));
assertThat(msv.containsKey(7), equalTo(true));
assertThat(msv.containsKey(8), equalTo(false));
assertThat(msv.get(3), closeTo(4, 1.0e-5));
assertThat(msv.get(7), closeTo(2, 1.0e-5));
scorer.score(5, msv);
assertThat(msv.keySet().isEmpty(), equalTo(true));
}