/** * Calls the method index(Collection[]) of the * class Indexer in order to build the data * structures for a set of collections. This * particular method of the Indexer uses a * set of builders for a subset of the collection * and builds separate data structures, which are * later merged. */ @Override public void index() { if (Index.existsIndex(path, prefix)) { logger.error("Cannot index while an index exists at "+path + ","+ prefix); return; } loadIndexer(path, prefix).index(new Collection[] {collectionTREC}); try{ collectionTREC.close(); } catch (Exception e) { logger.warn("problem closing collection", e); } }
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 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);
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);