/** Returns the last docid in this index **/ public int getEnd() { return this.getCollectionStatistics().getNumberOfDocuments()-1; } }
/** Returns the last docid in this index **/ public int getEnd() { return this.getCollectionStatistics().getNumberOfDocuments()-1; } }
@Override public int getNumberOfDocuments() { return index.getCollectionStatistics().getNumberOfDocuments(); }
@Override public int getNumberOfDocuments() { return index.getCollectionStatistics().getNumberOfDocuments(); }
/** {@inheritDoc} */ public CollectionStatistics getCollectionStatistics() { int ondisk = indices.size(); CollectionStatistics[] stats = new CollectionStatistics[ondisk]; int i =0; for (Index index : selectiveMatchingPolicy.getSelectedIndices(indices)) { stats[i] = index.getCollectionStatistics(); i++; } return MultiStats.factory(stats); }
public ScoringMatching(Index _index, Matching _parent, WeightingModel _wm, Predicate<Pair<String,Set<String>>> _filter) { super(_index, _parent, _wm, _filter); if (this.index != null) { this.lexicon = index.getLexicon(); this.invertedIndex = index.getInvertedIndex(); this.cs = index.getCollectionStatistics(); } }
public ScoringMatching(Index _index, Matching _parent) { super(_index, _parent, null); if (this.index != null) { this.lexicon = index.getLexicon(); this.invertedIndex = index.getInvertedIndex(); this.cs = index.getCollectionStatistics(); } }
public ScoringMatching(Index _index, Matching _parent, WeightingModel _wm) { super(_index, _parent, _wm); if (this.index != null) { this.lexicon = index.getLexicon(); this.invertedIndex = index.getInvertedIndex(); this.cs = index.getCollectionStatistics(); } }
public ScoringMatching(Index _index, Matching _parent) { super(_index, _parent, null); if (this.index != null) { this.lexicon = index.getLexicon(); this.invertedIndex = index.getInvertedIndex(); this.cs = index.getCollectionStatistics(); } }
public ScoringMatching(Index _index, Matching _parent, WeightingModel _wm, Predicate<Pair<String,Set<String>>> _filter) { super(_index, _parent, _wm, _filter); if (this.index != null) { this.lexicon = index.getLexicon(); this.invertedIndex = index.getInvertedIndex(); this.cs = index.getCollectionStatistics(); } }
public ScoringMatching(Index _index, Matching _parent, WeightingModel _wm) { super(_index, _parent, _wm); if (this.index != null) { this.lexicon = index.getLexicon(); this.invertedIndex = index.getInvertedIndex(); this.cs = index.getCollectionStatistics(); } }
@Override public void configureIndex(Index index) { lastIndex = index; documentIndex = index.getDocumentIndex(); invertedIndex = index.getInvertedIndex(); lexicon = index.getLexicon(); collStats = index.getCollectionStatistics(); directIndex = index.getDirectIndex(); metaIndex = index.getMetaIndex(); } /** Obtain the query expansion model for QE to use.
@Override public void configureIndex(Index index) { lastIndex = index; documentIndex = index.getDocumentIndex(); invertedIndex = index.getInvertedIndex(); lexicon = index.getLexicon(); collStats = index.getCollectionStatistics(); directIndex = index.getDirectIndex(); metaIndex = index.getMetaIndex(); } /** Obtain the query expansion model for QE to use.
void _testIndexTrailingEmptyDocument(Class<? extends Indexer> clz) throws Exception { Index index = IndexTestUtils.makeIndex( new String[]{"doc1", "doc2", "doc3"}, new String[]{"test document", "another test document", "" /* empty doc */}, clz); assertEquals(3, index.getCollectionStatistics().getNumberOfDocuments()); }
@Test public void testParallel() throws Exception { PrintWriter p = new PrintWriter(Files.writeFileWriter(ApplicationSetup.COLLECTION_SPEC)); p.println(System.getProperty("user.dir") + "/../../share/tests/shakespeare/shakespeare-merchant.trec.1"); p.println(System.getProperty("user.dir") + "/../../share/tests/shakespeare/shakespeare-merchant.trec.2"); p.close(); CLITool.main(new String[]{"batchindexing", "-b", "-p"}); Index index = Index.createIndex(); assertNotNull(index); assertEquals(22, index.getCollectionStatistics().getNumberOfDocuments()); assertTrue( index.getDirectIndex().getPostings(index.getDocumentIndex().getDocumentEntry(0)) instanceof BlockPosting ); }
@Test public void test() throws Exception { PrintWriter p = new PrintWriter(Files.writeFileWriter(ApplicationSetup.COLLECTION_SPEC)); p.println(System.getProperty("user.dir") + "/../../share/tests/shakespeare/shakespeare-merchant.trec.1"); p.println(System.getProperty("user.dir") + "/../../share/tests/shakespeare/shakespeare-merchant.trec.2"); p.close(); CLITool.main(new String[]{"batchindexing", "-b"}); Index index = Index.createIndex(); assertNotNull(index); assertEquals(22, index.getCollectionStatistics().getNumberOfDocuments()); assertTrue( index.getDirectIndex().getPostings(index.getDocumentIndex().getDocumentEntry(0)) instanceof BlockPosting ); }
protected void checkCollectionStatistics(Index index) { final CollectionStatistics cs = index.getCollectionStatistics(); System.err.println("num docs=" + cs.getNumberOfDocuments()); assertEquals("Number of documents doesn't match", DOCUMENT_LENGTHS.length, cs.getNumberOfDocuments()); assertEquals("Number of tokens doesn't match", StaTools.sum(DOCUMENT_LENGTHS), cs.getNumberOfTokens()); assertEquals("Average document length doesn't match", StaTools.mean(DOCUMENT_LENGTHS), cs.getAverageDocumentLength(), 0.0d); assertEquals("Number of pointers doesnt match", NUMBER_POINTERS, cs.getNumberOfPointers()); assertEquals("Number of unique terms doesn't match", NUMBER_UNIQUE_TERMS, cs.getNumberOfUniqueTerms()); }
@Test public void testSingleTermNoMatch() throws Exception { Index index = createIndex(); MatchingQueryTerms mqt = new MatchingQueryTerms(); mqt.addTermPropertyWeight("red", 1.2d); mqt.setDefaultTermWeightingModel(new TF_IDF()); PostingListManager p; p = new PostingListManager(index, index.getCollectionStatistics(), mqt); p.prepare(true); assertEquals(0, p.size()); p.close(); }
@Ignore @Test public void testSynonymNoMatch() throws Exception { Index index = createIndex(); MatchingQueryTerms mqt = new MatchingQueryTerms(); mqt.addTermPropertyWeight("badger|mole", 1.2d); mqt.setDefaultTermWeightingModel(new TF_IDF()); PostingListManager p; p = new PostingListManager(index, index.getCollectionStatistics(), mqt); p.prepare(true); assertEquals(0, p.size()); p.close(); }
@Test public void testMultipleTermNoMatch() throws Exception { Index index = createIndex(); MatchingQueryTerms mqt = new MatchingQueryTerms(); mqt.addTermPropertyWeight("badger", 1.2d); mqt.addTermPropertyWeight("mole", 1.2d); mqt.setDefaultTermWeightingModel(new TF_IDF()); PostingListManager p; p = new PostingListManager(index, index.getCollectionStatistics(), mqt); p.prepare(true); assertEquals(0, p.size()); p.close(); }