public DocumentIndexEntry getDocumentEntry(int docid) throws IOException { synchronized (parent) { return parent.getDocumentEntry(docid); } }
public int getDocumentLength(int docid) throws IOException { synchronized (parent) { return parent.getDocumentLength(docid); } }
/** {@inheritDoc} */ public int getNumberOfDocuments() { int numberofdocs = 0; for (int i = 0; i < docs.length; i++) numberofdocs += docs[i].getNumberOfDocuments(); return numberofdocs; }
/** * Adds the feedback document from the index given a docid */ public void insertDocument(int docid, int rank, double score) throws IOException { totalDocumentLength += documentIndex.getDocumentLength(docid); final IterablePosting ip = directIndex.getPostings((BitIndexPointer)documentIndex.getDocumentEntry(docid)); if (ip == null) { logger.warn("document id "+docid+" not found"); return; } while(ip.next() != IterablePosting.EOL) { this.insertTerm(ip.getId(), ip.getFrequency()); } feedbackDocumentCount++; }
for (int i=0;i<docindex1.getNumberOfDocuments();i++) assertArrayEquals(meta1.getAllItems(i), meta2.getAllItems(i)); assertEquals(docindex1.getNumberOfDocuments(),docindex2.getNumberOfDocuments()); for (int i=0;i<docindex1.getNumberOfDocuments();i++) assertEquals(docindex1.getDocumentLength(i),docindex2.getDocumentLength(i));
/** * Adds the feedback document from the index given a docid */ public void insertDocument(int docid, int rank, double score) throws IOException { totalDocumentLength += documentIndex.getDocumentLength(docid); final IterablePosting ip = directIndex.getPostings((BitIndexPointer)documentIndex.getDocumentEntry(docid)); if (ip == null) { logger.warn("document id "+docid+" not found"); return; } while(ip.next() != IterablePosting.EOL) { this.insertTerm(ip.getId(), ip.getFrequency()); } feedbackDocumentCount++; }
public DocumentIndexEntry getDocumentEntry(int docid) throws IOException { synchronized (parent) { return parent.getDocumentEntry(docid); } }
for(docid =0; docid < numberOfDocuments; docid++) assertEquals("Document lengths for docid "+ docid + " dont match", lengths[docid], di.getDocumentLength(docid)); assertEquals("Document lengths for docid "+ docid + " dont match", lengths[docid], di.getDocumentEntry(docid).getDocumentLength()); if (document_unique_terms.length > 0) assertEquals("Number of pointers for docid " + docid + " dont match", document_unique_terms[docid], di.getDocumentEntry(docid).getNumberOfEntries());
/** {@inheritDoc} */ public int getDocumentLength(int docid) throws IOException { int offset = 0, i = 0; for (DocumentIndex doc : docs) { if (docid < (offsets[i] + offset)) return doc.getDocumentLength(docid - offset); offset += offsets[i++]; } return 0; }
public int getNumberOfDocuments() { return di.getNumberOfDocuments(); }
/** {@inheritDoc} */ public DocumentIndexEntry getDocumentEntry(int docid) throws IOException { int offset = 0, i = 0; //System.err.println("MultiDoc: Getting docid="+docid); for (DocumentIndex doc : docs) { if (docid < (offsets[i] + offset)) { //System.err.println("Found docid="+docid+", is local docid "+(docid-offset)+" in shard "+i+" and has length "+d.getDocumentLength()+" ("+d.pointerToString()+")"); return new MultiDocumentEntry(doc.getDocumentEntry(docid - offset),i); } offset += offsets[i++]; } return null; }
assertEquals(3, doi.getDocumentLength(0)); assertEquals(4, doi.getDocumentLength(1)); if (fieldsExpected) } else { FieldDocumentIndexEntry fdie; fdie = (FieldDocumentIndexEntry) doi.getDocumentEntry(0); assertEquals(1, fdie.getFieldLengths()[0]); assertEquals(2, fdie.getFieldLengths()[1]); fdie = (FieldDocumentIndexEntry) doi.getDocumentEntry(1); assertEquals(1, fdie.getFieldLengths()[0]); assertEquals(3, fdie.getFieldLengths()[1]); DocumentIndexEntry de = documentIndex.getDocumentEntry(d); assertNotNull(de); ip = directIndex.getPostings(de);
public int getDocumentLength(int docid) throws IOException { synchronized (parent) { return parent.getDocumentLength(docid); } }
public int getNumberOfDocuments() { return parent.getNumberOfDocuments(); }
@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]; } }
@Override public int getDocumentLength() { try{ return documentIndex.getDocumentLength(id); } catch (Exception e) { logger.error("Problem looking for doclength for document "+ id, e); return -1; } }
public int getNumberOfDocuments() { return parent.getNumberOfDocuments(); }
@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]; } }
@Override public int getDocumentLength() { try{ return documentIndex.getDocumentLength(id); } catch (Exception e) { logger.error("Problem looking for doclength for document "+ id, e); return -1; } }
public int getNumberOfDocuments() { return di.getNumberOfDocuments(); }