@Override protected void addPosting(Posting _p) { super.addPosting(_p); FieldPosting p = (FieldPosting)_p; final int[] thisPostingFieldFreqs = p.getFieldFrequencies(); for(int fi=0;fi<fieldCount;fi++) fieldFreqs[fi] += thisPostingFieldFreqs[fi]; }
@Override public int next() throws IOException { while( (currentId = iterableParent.next()) != EOL) { final int fieldFreq = fieldParent.getFieldFrequencies()[fieldId]; if (fieldFreq > 0) { frequency = fieldFreq; return currentId; } } return EOL; }
@Override public WritablePosting asWritablePosting() { return new FieldPostingImpl(this.getId(), this.getFrequency(), this.getFieldFrequencies()); }
public static void compareBlockFieldPostings(List<Posting> inputPostings, IterablePosting outputPostings) throws Exception { for(Posting p : inputPostings) { assertEquals(p.getId(), outputPostings.next()); assertEquals(p.getId(), outputPostings.getId()); assertEquals(p.getFrequency(), outputPostings.getFrequency()); assertArrayEquals(((FieldPosting) p).getFieldFrequencies(), ((FieldPosting) p).getFieldFrequencies()); assertArrayEquals(((BlockPosting) p).getPositions(), ((BlockPosting) p).getPositions()); } assertTrue(outputPostings.next() == IterablePosting.EOL); assertTrue(outputPostings.getId() == IterablePosting.EOL); //TR-519 }
/** Get an array of all the ids in a given IterablePosting stream, * where the length of the stream is known */ public static int[] getIds(final IterablePosting ip, final int numPointers) throws IOException { final int[] ids = new int[numPointers]; for(int i=0;ip.next() != IterablePosting.EOL;i++) ids[i] = ip.getId(); return ids; }
@Override public WritablePosting asWritablePosting() { return new BlockFieldPostingImpl(this.getId(), this.getFrequency(), this.getPositions(), this.getFieldFrequencies()); }
/** Returns the minimum docid of the current postings in the array of IterablePostings * @return minimum docid, or -1 if all postings have ended. */ public static int selectMinimumDocId(final IterablePosting postingListArray[]) { int docid = Integer.MAX_VALUE; for (IterablePosting postingList: postingListArray) if (!postingList.endOfPostings() && docid > postingList.getId()) docid = postingList.getId(); if (docid == Integer.MAX_VALUE) docid = -1; return docid; }
@Override public WritablePosting asWritablePosting() { return new BlockPostingImpl(this.getId(), this.getFrequency(), this.getPositions()); }
/** {@inheritDoc} */ public WritablePosting asWritablePosting() { return new BasicPostingImpl(id, tf); }
@Override public int next() throws IOException { int rtr = super.next(); if (indice > 0) positionIndice += posCount[indice-1]; return rtr; }
@Override public int next() throws IOException { int rtr = super.next(); if (indice > 0) positionIndice += posCount[indice-1]; return rtr; } }
public static void compareBlockPostings(List<Posting> inputPostings, IterablePosting outputPostings) throws Exception { for(Posting p : inputPostings) { assertEquals(p.getId(), outputPostings.next()); assertEquals(p.getId(), outputPostings.getId()); assertEquals(p.getFrequency(), outputPostings.getFrequency()); assertArrayEquals(((BlockPosting) p).getPositions(), ((BlockPosting) p).getPositions()); } assertTrue(outputPostings.next() == IterablePosting.EOL); assertTrue(outputPostings.getId() == IterablePosting.EOL); //TR-519 }
@Override public int next() throws IOException { while( (currentId = iterableParent.next()) != EOL) { final int fieldFreq = fieldParent.getFieldFrequencies()[fieldId]; if (fieldFreq > 0) { frequency = fieldFreq; return currentId; } } return EOL; }
@Override public WritablePosting asWritablePosting() { return new FieldPostingImpl(this.getId(), this.getFrequency(), this.getFieldFrequencies()); }
@Override public WritablePosting asWritablePosting() { return new BlockFieldPostingImpl(this.getId(), this.getFrequency(), this.getPositions(), this.getFieldFrequencies()); }
@Override public WritablePosting asWritablePosting() { return new BlockPostingImpl(this.getId(), this.getFrequency(), this.getPositions()); }
@Override protected void addPosting(Posting _p) { super.addPosting(_p); FieldPosting p = (FieldPosting)_p; final int[] thisPostingFieldFreqs = p.getFieldFrequencies(); for(int fi=0;fi<fieldCount;fi++) fieldFreqs[fi] += thisPostingFieldFreqs[fi]; }
/** {@inheritDoc} */ public WritablePosting asWritablePosting() { return new BasicPostingImpl(id, tf); }
public static void compareFieldPostings(List<Posting> inputPostings, IterablePosting outputPostings) throws Exception { for(Posting p : inputPostings) { assertEquals(p.getId(), outputPostings.next()); assertEquals(p.getId(), outputPostings.getId()); assertEquals(p.getFrequency(), outputPostings.getFrequency()); assertArrayEquals(((FieldPosting) p).getFieldFrequencies(), ((FieldPosting) p).getFieldFrequencies()); } assertTrue(outputPostings.next() == IterablePosting.EOL); assertTrue(outputPostings.getId() == IterablePosting.EOL); //TR-519 }