/** * Closes the underlying bit file. */ public void close() throws IOException { if (file != null) file.close(); index.close(); }
@Override public int run(String[] args) { try{ IndexOnDisk.setIndexLoadingProfileAsRetrieval(false); IndexOnDisk index = Index.createIndex(); recompressInverted(index); index.close(); }catch (Exception e) { throw new RuntimeException(e); } return 0; }
@Override public int run(String[] args) { try{ IndexOnDisk.setIndexLoadingProfileAsRetrieval(false); IndexOnDisk index = Index.createIndex(); recompressInverted(index); index.close(); }catch (Exception e) { throw new RuntimeException(e); } return 0; }
/** Reopen an existing index */ public static IndexOnDisk reOpenIndex(IndexOnDisk index) throws IOException { IndexOnDisk rtr = null; String path = index.getPath(); String prefix = index.getPrefix(); index.close(); rtr = Index.createIndex(path, prefix); return rtr; }
/** Reopen an existing index */ public static IndexOnDisk reOpenIndex(IndexOnDisk index) throws IOException { IndexOnDisk rtr = null; String path = index.getPath(); String prefix = index.getPrefix(); index.close(); rtr = Index.createIndex(path, prefix); return rtr; }
@Override public int run(CommandLine line) throws Exception { Index.setIndexLoadingProfileAsRetrieval(false); IndexOnDisk i = Index.createIndex(); if (i== null) { System.err.println("Sorry, no index could be found in default location"); return 1; } Inverted2DirectIndexBuilder i2d = null; //disabling TR-279 optimisation //LexiconBuilder.reAssignTermIds(i, "lexicon", i.getCollectionStatistics().getNumberOfUniqueTerms()); if (line.hasOption('b')) i2d = new BlockInverted2DirectIndexBuilder(i); i2d = new Inverted2DirectIndexBuilder(i); i2d.createDirectIndex(); i.close(); return 0; }
@Override public String apply(String t, String u) { Index.setIndexLoadingProfileAsRetrieval(false); IndexOnDisk src1 = IndexOnDisk.createIndex(path, t); IndexOnDisk src2 = IndexOnDisk.createIndex(path, u); String thisPrefix = prefix + "_merge"+mergeCounter.getAndIncrement(); IndexOnDisk newIndex = IndexOnDisk.createNewIndex(path, thisPrefix); if (blocks) new BlockStructureMerger(src1, src2, newIndex).mergeStructures(); else new StructureMerger(src1, src2, newIndex).mergeStructures(); try { src1.close(); src2.close(); newIndex.close(); //TODO: could index deletion occur in parallel IndexUtil.deleteIndex(path, t); IndexUtil.deleteIndex(path, u); } catch (IOException e) { throw new RuntimeException(e); } return thisPrefix; } };
index.close(); IndexUtil.deleteIndex(((IndexOnDisk)index).getPath(), ((IndexOnDisk)index).getPrefix());
index.close(); IndexUtil.deleteIndex(((IndexOnDisk)index).getPath(), ((IndexOnDisk)index).getPrefix());
protected void doIndexing(String... trec_terrier_args) throws Exception { String path = ApplicationSetup.TERRIER_INDEX_PATH; String prefix = ApplicationSetup.TERRIER_INDEX_PREFIX; TrecTerrier.main(joinSets(trec_terrier_args, indexingOptions)); //check that application setup hasnt changed unexpectedly assertEquals(path, ApplicationSetup.TERRIER_INDEX_PATH); assertEquals(prefix, ApplicationSetup.TERRIER_INDEX_PREFIX); //check that indexing actually created an index assertTrue("Index does not exist at ["+ApplicationSetup.TERRIER_INDEX_PATH+","+ApplicationSetup.TERRIER_INDEX_PREFIX+"]", Index.existsIndex(ApplicationSetup.TERRIER_INDEX_PATH, ApplicationSetup.TERRIER_INDEX_PREFIX)); IndexOnDisk i = Index.createIndex(); assertNotNull(Index.getLastIndexLoadError(), i); assertEquals(ApplicationSetup.TERRIER_VERSION,i.getIndexProperty("index.terrier.version", "")); assertTrue("Index does not have an inverted structure", i.hasIndexStructure("inverted")); assertTrue("Index does not have an lexicon structure", i.hasIndexStructure("lexicon")); assertTrue("Index does not have an document structure", i.hasIndexStructure("document")); assertTrue("Index does not have an meta structure", i.hasIndexStructure("meta")); addDirectStructure(i); i.close(); finishIndexing(); }
assertTrue("Index does not have an meta structure", i.hasIndexStructure("meta")); addDirectStructure(i); i.close(); finishIndexing();
assertTrue("Index does not have an meta structure", i.hasIndexStructure("meta")); addDirectStructure(i); i.close(); finishIndexing();