/** Add statistics for this posting onto the given LexiconEntry */ public void addToLexiconEntry(LexiconEntry le) { le.setStatistics(le.getDocumentFrequency() + termDf, le.getFrequency() + termTF); if (maxtf > le.getMaxFrequencyInDocuments()) le.setMaxFrequencyInDocuments(maxtf); }
protected ResultSet _testMatchingNonStatisticsOverwrite() throws Exception { Index index = IndexTestUtils.makeIndex( new String[]{"doc1"}, new String[]{"The quick brown fox jumps over the lazy dog"}); assertNotNull(index); System.err.println("testMatchingNonStatisticsOverwrite: " + index.toString()); assertEquals(1, index.getCollectionStatistics().getNumberOfDocuments()); Matching matching = makeMatching(index); assertNotNull(matching); MatchingQueryTerms mqt = new MatchingQueryTerms(); LexiconEntry le = index.getLexicon().getLexiconEntry("quick"); assertNotNull(le); le.setStatistics(1, 40); mqt.setTermProperty("quick", le); mqt.setDefaultTermWeightingModel(new DLH13()); ResultSet rs = matching.match("query1", mqt); assertNotNull(rs); assertEquals(1, rs.getResultSize()); assertEquals(0, rs.getDocids()[0]); //check that statistics havent been overwritten assertEquals(40, mqt.getStatistics("quick").getFrequency()); return rs; }