@Override public int getId() { //System.err.println("PostingWrapper: Local ID="+posting.getId()); return posting.getId()+idoffset; }
/** {@inheritDoc} */ public int getId() { return children[currentChild].getId() + offsets[currentChild]; }
/** 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; }
/** 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; }
/** 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; }
/** 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; }
/** Get an array of all the ids and frequencies in a given IterablePosting stream, * where the length of the stream is unknown */ public static int[][] getAllPostings(final IterablePosting ip, final int numPointers) throws IOException { final int[][] rtr = new int[2][numPointers]; for(int i=0;ip.next() != IterablePosting.EOL;i++) { rtr[0][i] = ip.getId(); rtr[1][i] = ip.getFrequency(); } return rtr; }
/** Get an array of all the ids and frequencies in a given IterablePosting stream, * where the length of the stream is unknown */ public static int[][] getAllPostings(final IterablePosting ip, final int numPointers) throws IOException { final int[][] rtr = new int[2][numPointers]; for(int i=0;ip.next() != IterablePosting.EOL;i++) { rtr[0][i] = ip.getId(); rtr[1][i] = ip.getFrequency(); } return rtr; }
/** Get an array of all the ids in a given IterablePosting stream */ public static int[] getIds(final IterablePosting ip) throws IOException { final TIntArrayList ids = new TIntArrayList(); while(ip.next() != IterablePosting.EOL) ids.add(ip.getId()); return ids.toNativeArray(); }
/** Get an array of all the ids in a given IterablePosting stream */ public static int[] getIds(final IterablePosting ip) throws IOException { final TIntArrayList ids = new TIntArrayList(); while(ip.next() != IterablePosting.EOL) ids.add(ip.getId()); return ids.toNativeArray(); }
/** Get an array of all the ids in a given IterablePosting stream, * where the length of the stream is known */ public static int[][] getAllPostings(final IterablePosting ip) throws IOException { if (ip == null) return null; final TIntArrayList ids = new TIntArrayList(); final TIntArrayList tfs = new TIntArrayList(); while(ip.next() != IterablePosting.EOL) { ids.add(ip.getId()); tfs.add(ip.getFrequency()); } return new int[][]{ids.toNativeArray(), tfs.toNativeArray()}; }
/** Get an array of all the ids in a given IterablePosting stream, * where the length of the stream is known */ public static int[][] getAllPostings(final IterablePosting ip) throws IOException { if (ip == null) return null; final TIntArrayList ids = new TIntArrayList(); final TIntArrayList tfs = new TIntArrayList(); while(ip.next() != IterablePosting.EOL) { ids.add(ip.getId()); tfs.add(ip.getFrequency()); } return new int[][]{ids.toNativeArray(), tfs.toNativeArray()}; }
public static void comparePostings(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()); } assertTrue(outputPostings.next() == IterablePosting.EOL); assertTrue(outputPostings.getId() == IterablePosting.EOL); //TR-519 }
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 }
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 }
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 }
@Test public void testManySomeOverlapSkipPast() throws Exception { IterablePosting[] ips = new IterablePosting[]{ new ArrayOfBasicIterablePosting(new int[]{0,1}, new int[]{1,1}, new int[]{4,5}), new ArrayOfBasicIterablePosting(new int[]{1,2}, new int[]{2,2}, new int[]{5,6}), }; IterablePosting joined = joinPostings(ips); assertEquals(0, joined.next(0)); assertEquals(0, joined.getId()); assertEquals(1, joined.getFrequency()); assertEquals(4, joined.getDocumentLength()); assertEquals(IterablePosting.EOL, joined.next(3)); }
@Test public void doTest() throws Exception { ArrayOfFieldIterablePosting fips = getFips(); IterablePosting ip1 = new FieldOnlyIterablePosting(fips, 0); assertEquals(1, ip1.next()); assertEquals(1, ip1.getFrequency()); assertEquals(2, ip1.getDocumentLength()); assertEquals(2, ip1.next()); assertEquals(8, ip1.getFrequency()); assertEquals(3, ip1.getDocumentLength()); assertEquals(IterablePosting.EOL, ip1.next()); assertEquals(IterablePosting.EOL, ip1.getId()); ip1.close(); }