Package org.terrier.structures.postings

Examples of org.terrier.structures.postings.BasicPostingImpl


    return (indice == ids.length -1);
  }

  /** {@inheritDoc} */
  public WritablePosting asWritablePosting() {
    return new BasicPostingImpl(ids[indice], 0);
  }
View Full Code Here


    public void setId(int id) {} 
    public void close() throws IOException {  }

    public WritablePosting asWritablePosting() {
      BasicPostingImpl bp = new BasicPostingImpl(docid, frequency);
      return bp;
    }
View Full Code Here

      terms = _terms;
      termIds = _termIds;
    }
   
    public WritablePosting asWritablePosting() {
      return new BasicPostingImpl(termIds[i], getFrequency());
    }
View Full Code Here

    public boolean endOfPostings() {
      return (indice == node_links.length -1);
    }

    public WritablePosting asWritablePosting() {
      return new BasicPostingImpl(node_links[indice], 0);
    }
View Full Code Here

 
  @SuppressWarnings("unchecked")
  @Test public void testSingleEntrySinglePosting() throws Exception
  {
    List<Posting> postings = new ArrayList<Posting>();
    postings.add(new BasicPostingImpl(1,1));
    List<BitIndexPointer> pointerList = new ArrayList<BitIndexPointer>();
    String filename = PostingTestUtils.writePostingsToFile(new Iterator[]{postings.iterator()}, pointerList);
    BitInputStream bitIn = new BitInputStream(filename);
    IterablePosting ip = new BasicIterablePosting(bitIn, postings.size(), null);
    PostingTestUtils.comparePostings(postings, ip);
View Full Code Here

 
  @SuppressWarnings("unchecked")
  @Test public void testSingleEntrySeveralPostings() throws Exception
  {
    List<Posting> postings = new ArrayList<Posting>();
    postings.add(new BasicPostingImpl(1,1));
    postings.add(new BasicPostingImpl(2,1));
    postings.add(new BasicPostingImpl(10,1));
    postings.add(new BasicPostingImpl(100,1));
    List<BitIndexPointer> pointerList = new ArrayList<BitIndexPointer>();
    String filename = PostingTestUtils.writePostingsToFile(new Iterator[]{postings.iterator()}, pointerList);
    BitInputStream bitIn = new BitInputStream(filename);
    IterablePosting ip = new BasicIterablePosting(bitIn, postings.size(), null);
    PostingTestUtils.comparePostings(postings, ip);
View Full Code Here

 
  @SuppressWarnings("unchecked")
  @Test public void testSingleEntrySinglePostingSingleFile() throws Exception
  {
    List<Posting> postings = new ArrayList<Posting>();
    postings.add(new BasicPostingImpl(1,1));
    List<BitIndexPointer> pointerList = new ArrayList<BitIndexPointer>();
    String filename = PostingTestUtils.writePostingsToFile(new Iterator[]{postings.iterator()}, pointerList);
    BitPostingIndexInputStream structure = new BitPostingIndexInputStream(filename, (byte)1, pointerList.iterator(), BasicIterablePosting.class, 0);
    assertTrue(structure.hasNext());
    PostingTestUtils.assertEqualsBitFilePosition(pointerList.get(0), structure.getPos());
View Full Code Here

 
  @SuppressWarnings("unchecked")
  @Test public void testSingleEntryMultiplePostingSingleFile() throws Exception
  {
    List<Posting> postings = new ArrayList<Posting>();
    postings.add(new BasicPostingImpl(1,1));
    postings.add(new BasicPostingImpl(1000,1000));
    postings.add(new BasicPostingImpl(1001,1000));
    List<BitIndexPointer> pointerList = new ArrayList<BitIndexPointer>();
    String filename = PostingTestUtils.writePostingsToFile(new Iterator[]{postings.iterator()}, pointerList);
    BitPostingIndexInputStream structure = new BitPostingIndexInputStream(filename, (byte)1, pointerList.iterator(), BasicIterablePosting.class, 0);
    assertTrue(structure.hasNext());
    PostingTestUtils.comparePostings(postings, structure.next());
View Full Code Here

 
  @SuppressWarnings("unchecked")
  @Test public void testMultipleEntryMultiplePostingSingleFile() throws Exception
  {
    List<Posting> postings1 = new ArrayList<Posting>();
    postings1.add(new BasicPostingImpl(1,1));
    postings1.add(new BasicPostingImpl(1000,1000));
    postings1.add(new BasicPostingImpl(1001,1000));
   
    List<Posting> postings2 = new ArrayList<Posting>();
    postings2.add(new BasicPostingImpl(2,20));
    postings2.add(new BasicPostingImpl(2000,1000));
    postings2.add(new BasicPostingImpl(2001,1000));
   
    List<BitIndexPointer> pointerList = new ArrayList<BitIndexPointer>();
    String filename = PostingTestUtils.writePostingsToFile(new Iterator[]{postings1.iterator(), postings2.iterator()}, pointerList);
    BitPostingIndexInputStream structure = new BitPostingIndexInputStream(filename, (byte)1, pointerList.iterator(), BasicIterablePosting.class, 0);
    assertTrue(structure.hasNext());
View Full Code Here

 
  @SuppressWarnings("unchecked")
  void doSpecific1MultipleEntryMultiplePostingSingleFile (boolean docids) throws Exception
  {
    List<Posting> postings0 = new ArrayList<Posting>();
    postings0.add(new BasicPostingImpl(100,1));
    postings0.add(new BasicPostingImpl(200,1000));
    postings0.add(new BasicPostingImpl(300,1000));
    postings0.add(new BasicPostingImpl(400,1000));
   
    List<Posting> postings1 = new ArrayList<Posting>();
    postings1.add(new BasicPostingImpl(0,1));
    postings1.add(new BasicPostingImpl(1,1000));
    postings1.add(new BasicPostingImpl(2,1000));
    postings1.add(new BasicPostingImpl(4,1000));
    postings1.add(new BasicPostingImpl(8,1000));
   
    List<Posting> postings2 = new ArrayList<Posting>();
    postings2.add(new BasicPostingImpl(0,20));
    postings2.add(new BasicPostingImpl(8,1000));
    postings2.add(new BasicPostingImpl(10,1000));
   
    IterablePosting ip;
    final List<BitIndexPointer> pointerList = new ArrayList<BitIndexPointer>();
    final String filename = docids
      ? PostingTestUtils.writePostingsToFileDocidOnly(new Iterator[]{postings0.iterator(), postings1.iterator(), postings2.iterator()}, pointerList)
View Full Code Here

TOP

Related Classes of org.terrier.structures.postings.BasicPostingImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.