/** Print the contents of the document index */ @SuppressWarnings("unchecked") public static void printDocumentIndex(Index index, String structureName) throws IOException { Iterator<DocumentIndexEntry> iterator = (Iterator<DocumentIndexEntry>)index.getIndexStructureInputStream(structureName); int docid =0; while(iterator.hasNext()) { DocumentIndexEntry die = iterator.next(); System.out.println(docid +": " + die.toString()); docid++; } close(iterator); }
/** Print the contents of the document index */ @SuppressWarnings("unchecked") public static void printDocumentIndex(Index index, String structureName) throws IOException { Iterator<DocumentIndexEntry> iterator = (Iterator<DocumentIndexEntry>)index.getIndexStructureInputStream(structureName); int docid =0; while(iterator.hasNext()) { DocumentIndexEntry die = iterator.next(); System.out.println(docid +": " + die.toString()); docid++; } close(iterator); }
/** * 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(); }