assertEquals(terrier_etc, org.terrier.utility.ApplicationSetup.TERRIER_ETC); assertEquals(terrier_etc, org.terrier.utility.ApplicationSetup.TERRIER_INDEX_PATH); assertFalse(IndexOnDisk.existsIndex(org.terrier.utility.ApplicationSetup.TERRIER_INDEX_PATH, "data"));
public static Index makeIndexFields(String[] docnos, String[] documents, Indexer indexer, String path, String prefix) throws Exception { assertFalse("Index at "+ path + "," + prefix + " already exists!", IndexOnDisk.existsIndex(path, prefix)); assertEquals(docnos.length, documents.length); Document[] sourceDocs = new Document[docnos.length]; for(int i=0;i<docnos.length;i++) { Map<String,String> docProperties = new HashMap<String,String>(); docProperties.put("filename", docnos[i]); docProperties.put("docno", docnos[i]); sourceDocs[i] = new TaggedDocument(new ByteArrayInputStream(documents[i].getBytes()), docProperties, new EnglishTokeniser()); } Collection col = new CollectionDocumentList(sourceDocs, "filename"); indexer.index(new Collection[]{col}); Index index = Index.createIndex(path, prefix); assertNotNull(index); assertEquals(sourceDocs.length, index.getCollectionStatistics().getNumberOfDocuments()); return index; }
public static Index makeIndex(String[] docnos, String[] documents, Indexer indexer, String path, String prefix) throws Exception { assertFalse("Index at "+ path + "," + prefix + " already exists!", IndexOnDisk.existsIndex(path, prefix)); assertEquals(docnos.length, documents.length); Document[] sourceDocs = new Document[docnos.length]; for(int i=0;i<docnos.length;i++) { Map<String,String> docProperties = new HashMap<String,String>(); docProperties.put("filename", docnos[i]); docProperties.put("docno", docnos[i]); sourceDocs[i] = makeDocumentFromText(documents[i], docProperties); } Collection col = makeCollection(docnos, documents); indexer.index(new Collection[]{col}); Index index = Index.createIndex(path, prefix); assertNotNull(index); assertEquals(sourceDocs.length, index.getCollectionStatistics().getNumberOfDocuments()); return index; }
protected HttpServer makeServer(Index index, String uri) { String path = ((IndexOnDisk)index).getPath(); String prefix = ((IndexOnDisk)index).getPrefix(); assertTrue(IndexOnDisk.existsIndex(path,prefix)); ApplicationSetup.TERRIER_INDEX_PATH = path; ApplicationSetup.TERRIER_INDEX_PREFIX = prefix; HttpServer server = SingleIndexRestServer.startServer(uri); return server; } }