/** * {@inheritDoc} */ public final DocumentIndexEntry getDocumentEntry(int docid) throws IOException { if (docid == lastDocid) { return lastEntry; } try{ lastEntry = null; return lastEntry = get(lastDocid = docid); } catch (NoSuchElementException nsee) { return null; } } /**
@SuppressWarnings("unchecked") protected FSADocumentIndex(IndexOnDisk index, String structureName, boolean initialise) throws IOException { super( index.getPath() + "/" + index.getPrefix() + "."+ structureName + FSArrayFile.USUAL_EXTENSION, false, (FixedSizeWriteableFactory<DocumentIndexEntry>) index.getIndexStructure(structureName+"-factory") ); if (initialise) initialise(index, structureName); }
protected void initialise(IndexOnDisk index, String structureName) throws IOException { logger.debug("Loading document lengths for " + structureName + " structure into memory. NB: The following stacktrace IS NOT AN Exception", new Exception("THIS IS **NOT** AN EXCEPTION")); docLengths = new int[this.size()]; int i=0; Iterator<DocumentIndexEntry> iter = new FSADocumentIndexIterator(index, structureName); TerrierTimer tt = new TerrierTimer("Loading "+structureName+ " document lengths", this.size());tt.start(); while(iter.hasNext()) { docLengths[i++] = iter.next().getDocumentLength(); tt.increment(); } tt.finished(); IndexUtil.close(iter); } /**
@SuppressWarnings("unchecked") protected FSADocumentIndex(IndexOnDisk index, String structureName, boolean initialise) throws IOException { super( index.getPath() + "/" + index.getPrefix() + "."+ structureName + FSArrayFile.USUAL_EXTENSION, false, (FixedSizeWriteableFactory<DocumentIndexEntry>) index.getIndexStructure(structureName+"-factory") ); if (initialise) initialise(index, structureName); }
protected void initialise(IndexOnDisk index, String structureName) throws IOException { logger.debug("Loading document lengths for " + structureName + " structure into memory. NB: The following stacktrace IS NOT AN Exception", new Exception("THIS IS **NOT** AN EXCEPTION")); docLengths = new int[this.size()]; int i=0; Iterator<DocumentIndexEntry> iter = new FSADocumentIndexIterator(index, structureName); TerrierTimer tt = new TerrierTimer("Loading "+structureName+ " document lengths", this.size());tt.start(); while(iter.hasNext()) { docLengths[i++] = iter.next().getDocumentLength(); tt.increment(); } tt.finished(); IndexUtil.close(iter); } /**
/** * {@inheritDoc} */ public final DocumentIndexEntry getDocumentEntry(int docid) throws IOException { if (docid == lastDocid) { return lastEntry; } try{ lastEntry = null; return lastEntry = get(lastDocid = docid); } catch (NoSuchElementException nsee) { return null; } } /**