/** * main * @param args * @throws Exception */ public static void main (String args[]) throws Exception { IndexOnDisk index = Index.createIndex(); if (index == null) { System.err.println("Couldn't load index: " + Index.getLastIndexLoadError()); return; } PostingIndex<Pointer> direct = (PostingIndex<Pointer>) index.getDirectIndex(); DocumentIndex doc = index.getDocumentIndex(); DocumentIndexEntry die = doc.getDocumentEntry(Integer.parseInt(args[0])); System.err.println("docid" + args[0] + " pointer = "+ die.toString()); IterablePosting pi = direct.getPostings(die); System.out.print(args[0] + " "); while(pi.next() != IterablePosting.EOL) { System.out.print("(" + pi.getId() + ", " + pi.getFrequency() + ") "); } System.out.println(); }
/** * main * @param args * @throws Exception */ public static void main (String args[]) throws Exception { IndexOnDisk index = Index.createIndex(); if (index == null) { System.err.println("Couldn't load index: " + Index.getLastIndexLoadError()); return; } PostingIndex<Pointer> direct = (PostingIndex<Pointer>) index.getDirectIndex(); DocumentIndex doc = index.getDocumentIndex(); DocumentIndexEntry die = doc.getDocumentEntry(Integer.parseInt(args[0])); System.err.println("docid" + args[0] + " pointer = "+ die.toString()); IterablePosting pi = direct.getPostings(die); System.out.print(args[0] + " "); while(pi.next() != IterablePosting.EOL) { System.out.print("(" + pi.getId() + ", " + pi.getFrequency() + ") "); } System.out.println(); }
if (index == null) System.err.println("Index not found: " + Index.getLastIndexLoadError()); return 2;
if (index == null) System.err.println("Index not found: " + Index.getLastIndexLoadError()); return 2;
if (i == null) logger.error("No such index : "+ Index.getLastIndexLoadError()); } else { IndexUtil.printDocumentIndex(i, "document"); if (i == null) logger.error("No such index : "+ Index.getLastIndexLoadError()); if (i == null) logger.error("No such index : "+ Index.getLastIndexLoadError()); if (i == null) logger.error("No such index : "+ Index.getLastIndexLoadError()); if (i == null) logger.error("No such index : "+ Index.getLastIndexLoadError()); if (i == null) logger.error("No such index : "+ Index.getLastIndexLoadError());
if (i == null) logger.error("No such index : "+ Index.getLastIndexLoadError()); } else { IndexUtil.printDocumentIndex(i, "document"); if (i == null) logger.error("No such index : "+ Index.getLastIndexLoadError()); if (i == null) logger.error("No such index : "+ Index.getLastIndexLoadError()); if (i == null) logger.error("No such index : "+ Index.getLastIndexLoadError()); if (i == null) logger.error("No such index : "+ Index.getLastIndexLoadError()); if (i == null) logger.error("No such index : "+ Index.getLastIndexLoadError());
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(); }
assertNotNull(Index.getLastIndexLoadError(), i); assertEquals(ApplicationSetup.TERRIER_VERSION,i.getIndexProperty("index.terrier.version", "")); assertTrue("Index does not have an inverted structure", i.hasIndexStructure("inverted"));
assertNotNull(Index.getLastIndexLoadError(), i); assertEquals(ApplicationSetup.TERRIER_VERSION,i.getIndexProperty("index.terrier.version", "")); assertTrue("Index does not have an inverted structure", i.hasIndexStructure("inverted"));