/** * Constructs an instance of the class with * @param die */ public FieldDocumentIndexEntry(DocumentIndexEntry die) { super(die); if (die instanceof FieldDocumentIndexEntry) this.fieldLengths = ((FieldDocumentIndexEntry)die).getFieldLengths(); } /**
public DocumentIndexEntry next() { FieldDocumentIndexEntry die = new FieldDocumentIndexEntry(); die.setDocumentLength(docLengths.get(index)); die.setFieldLengths(fieldLengths.get(index++).toNativeArray()); return die; }
/** {@inheritDoc} */ public FieldDocumentIndexEntry getDocumentEntry(int docid) { FieldDocumentIndexEntry fdie = new FieldDocumentIndexEntry(); fdie.setDocumentLength(getDocumentLength(docid)); fdie.setFieldLengths(getFieldLengths(docid)); if (bitpointers.contains(docid)) fdie.setBitIndexPointer(bitpointers.get(docid)); return fdie; }
/** * {@inheritDoc} */ public DocumentIndexEntry getDocumentStatistics() { FieldDocumentIndexEntry fdie = new FieldDocumentIndexEntry(this.fieldCount); fdie.setDocumentLength(documentLength); fdie.setNumberOfEntries(occurrences.size()); fdie.setFieldLengths(fieldLengths); return fdie; }
@Override public DocumentIndexEntry newInstance() { return new FieldDocumentIndexEntry(fieldCount); }
@Override protected void initialise(IndexOnDisk index, String structureName) throws IOException { logger.debug("Loading document + field 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()]; fieldLengths = new int[this.size()][]; int i=0; Iterator<DocumentIndexEntry> iter = new FSADocumentIndexIterator(index, structureName); TerrierTimer tt = new TerrierTimer("Loading "+structureName+ " document + field lengths", this.size());tt.start(); while(iter.hasNext()) { FieldDocumentIndexEntry fdie = (FieldDocumentIndexEntry)iter.next(); docLengths[i] = fdie.getDocumentLength(); fieldLengths[i] = fdie.getFieldLengths(); i++; tt.increment(); } tt.finished(); IndexUtil.close(iter); } /**
@Override public DocumentIndexEntry newInstance() { return new FieldDocumentIndexEntry(fieldCount); }
@Override protected void initialise(IndexOnDisk index, String structureName) throws IOException { logger.debug("Loading document + field 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()]; fieldLengths = new int[this.size()][]; int i=0; Iterator<DocumentIndexEntry> iter = new FSADocumentIndexIterator(index, structureName); TerrierTimer tt = new TerrierTimer("Loading "+structureName+ " document + field lengths", this.size());tt.start(); while(iter.hasNext()) { FieldDocumentIndexEntry fdie = (FieldDocumentIndexEntry)iter.next(); docLengths[i] = fdie.getDocumentLength(); fieldLengths[i] = fdie.getFieldLengths(); i++; tt.increment(); } tt.finished(); IndexUtil.close(iter); } /**
/** * Constructs an instance of the class with * @param die */ public FieldDocumentIndexEntry(DocumentIndexEntry die) { super(die); if (die instanceof FieldDocumentIndexEntry) this.fieldLengths = ((FieldDocumentIndexEntry)die).getFieldLengths(); } /**
/** {@inheritDoc} */ @Override public DocumentIndexEntry getDocumentEntry(int docid) { FieldDocumentIndexEntry fdie = new FieldDocumentIndexEntry(); try { fdie.setDocumentLength(getDocumentLength(docid)); } catch (IOException e) { e.printStackTrace(); } fdie.setFieldLengths(getFieldLengths(docid)); return fdie; }
metaBuilder = createMetaIndexBuilder(); emptyDocIndexEntry = (FieldScore.FIELDS_COUNT > 0) ? new FieldDocumentIndexEntry(FieldScore.FIELDS_COUNT) : new SimpleDocumentIndexEntry();
public int[] getFieldLengths(int docid) throws IOException { return ((FieldDocumentIndexEntry)die).getFieldLengths(); } }
public Entry<Integer, DocumentIndexEntry> next() { FieldDocumentIndexEntry die = new FieldDocumentIndexEntry(); die.setDocumentLength(docLengths.get(index)); die.setFieldLengths(fieldLengths.get(index++).toNativeArray()); Entry<Integer, DocumentIndexEntry> e = new MapEntry<Integer, DocumentIndexEntry>(index, die); return e; }
metaBuilder = createMetaIndexBuilder(); emptyDocIndexEntry = (FieldScore.FIELDS_COUNT > 0) ? new FieldDocumentIndexEntry(FieldScore.FIELDS_COUNT) : new SimpleDocumentIndexEntry();
public int[] getFieldLengths(int docid) throws IOException { return ((FieldDocumentIndexEntry)die).getFieldLengths(); } }
emptyDocIndexEntry = (FieldScore.FIELDS_COUNT > 0) ? new FieldDocumentIndexEntry(FieldScore.FIELDS_COUNT) : new BasicDocumentIndexEntry();
@Override public int[] getFieldLengths() { if (fieldsCount <= 0) throw new UnsupportedOperationException(); try { if (asFieldDocumentIndex != null) { return asFieldDocumentIndex.getFieldLengths(id); } else { FieldDocumentIndexEntry fdie = ((FieldDocumentIndexEntry)documentIndex.getDocumentEntry(id)); return fdie.getFieldLengths(); } } catch (IOException ioe) { logger.error("Problem looking for doclength for document "+ id, ioe); return new int[0]; } }
emptyDocIndexEntry = (FieldScore.FIELDS_COUNT > 0) ? new FieldDocumentIndexEntry(FieldScore.FIELDS_COUNT) : new BasicDocumentIndexEntry();
@Override public int[] getFieldLengths() { if (fieldsCount <= 0) throw new UnsupportedOperationException(); try { if (asFieldDocumentIndex != null) { return asFieldDocumentIndex.getFieldLengths(id); } else { FieldDocumentIndexEntry fdie = ((FieldDocumentIndexEntry)documentIndex.getDocumentEntry(id)); return fdie.getFieldLengths(); } } catch (IOException ioe) { logger.error("Problem looking for doclength for document "+ id, ioe); return new int[0]; } }
/** {@inheritDoc} */ public int[] getFieldLengths() { if (doiIsFieldDocumentIndex) { try{ return fdoi.getFieldLengths(id); } catch (IOException ioe) { System.err.println("Problem looking for doclength for document "+ id); ioe.printStackTrace(); return new int[0]; } } else { FieldDocumentIndexEntry fdie = null; try{ fdie = ((FieldDocumentIndexEntry)doi.getDocumentEntry(id)); } catch (IOException ioe) { //TODO log? System.err.println("Problem looking for doclength for document "+ id); ioe.printStackTrace(); return new int[0]; } return fdie.getFieldLengths(); } }