void testSingleDocument(DependenceScoreModifier dsm) throws Exception { Index index1 = IndexTestUtils.makeIndexBlocks( new String[]{"doc1"}, new String[]{"The quick brown fox jumps over the lazy dog"}); ResultSet r; MatchingQueryTerms mqt; mqt = new MatchingQueryTerms(); mqt.setDefaultTermWeightingModel(new InL2()); mqt.add(QTPBuilder.of(new SingleTermOp("quick")).build()); mqt.add(QTPBuilder.of(new SingleTermOp("dog")).build()); r = new CollectionResultSet(1); r.getScores()[0] = 1.0d; dsm.modifyScores(index1, mqt, r); //TODO: MRF reduces the scores of non-matching documents? assertEquals(1.0d, r.getScores()[0], 0.2d); mqt = new MatchingQueryTerms(); mqt.setDefaultTermWeightingModel(new InL2()); mqt.add(QTPBuilder.of(new SingleTermOp("brown")).build()); mqt.add(QTPBuilder.of(new SingleTermOp("fox")).build()); r = new CollectionResultSet(1); r.getScores()[0] = 1.0d; dsm.modifyScores(index1, mqt, r); assertTrue(r.getScores()[0] > 1.0d); }