Package ivory.core.data.index

Examples of ivory.core.data.index.PostingsReader


    return collectionSize;
  }

  public PostingsReader getPostingsReader(Expression exp) {
    //LOG.info("**getPostingsReader("+exp+")");;
    PostingsReader postingsReader = null;
    try {
      if (exp.getType().equals(Expression.Type.OD)) {
        int gapSize = exp.getWindow();
        String[] terms = exp.getTerms();

        List<PostingsReader> readers = new ArrayList<PostingsReader>();
        for (int i = 0; i < terms.length; i++) {
          PostingsReader reader = constructPostingsReader(terms[i]);
          if(reader != null)
            readers.add(reader);
        }

        postingsReader = new ProximityPostingsReaderOrderedWindow(readers.toArray(new PostingsReader[0]), gapSize);
      } else if (exp.getType().equals(Expression.Type.UW)) {
        int windowSize = exp.getWindow();
        String[] terms = exp.getTerms();

        List<PostingsReader> readers = new ArrayList<PostingsReader>();
        for (int i = 0; i < terms.length; i++) {
          PostingsReader reader = constructPostingsReader(terms[i]);
          if(reader != null)
            readers.add(reader);
        }

        postingsReader = new ProximityPostingsReaderUnorderedWindow(readers.toArray(new PostingsReader[0]), windowSize);
View Full Code Here


    return postingsReader;
  }

  protected PostingsReader constructPostingsReader(String expression) throws Exception {
    //LOG.info("**constructPostingsReader("+expression+")");
    PostingsReader reader = null;

    if (mPostingsReaderCache != null) {
      reader = mPostingsReaderCache.get(expression);
    }

View Full Code Here

  public void writeCollectionAverageDocumentLength(float n) { FSProperty.writeFloat(fs, appendPath(indexPath, "property.CollectionAverageDocumentLength"), n); }

  private static void testTerm(RetrievalEnvironment env, String term) {
    long startTime = System.currentTimeMillis();

    PostingsReader reader = null;
    Posting p = new Posting();
    int df = 0;
    String termOrig = term;
    String termTokenized = env.tokenize(termOrig)[0];

    LOG.info("term=" + termOrig + ", tokenized=" + termTokenized);
    reader = env.getPostingsReader(new Expression(termTokenized));
    df = reader.getNumberOfPostings();
    LOG.info("First ten postings: ");
    for (int i = 0; i < (df < 10 ? df : 10); i++) {
      reader.nextPosting(p);
      System.out.print(p);
    }

    System.out.println("\n");
View Full Code Here

        out = fs.create(new Path(outputPath + "/" + i));
      }

      try {
        PostingsList pl = env.getPostingsList(env.getTermFromId(i));
        PostingsReader reader = pl.getPostingsReader();
        Signature filter = null;

        //Decide which filter to use based on the configuration parameters
        int df = pl.getDf();
        if (df <= bloomConfig.getIdentityHashThreshold()) {
          filter = new BloomFilterHash(df * bloomConfig.getBitsPerElement(),
                                       bloomConfig.getHashCount());
        } else {
          filter = new BloomFilterIdentityHash(bloomConfig.getDocumentCount());
        }

        while (reader.nextPosting(posting)) {
          filter.add(newDocids[posting.getDocno()]);
        }

        out.writeInt(i);
        out.writeInt(df);
View Full Code Here

        LOGGER.info(i + " posting lists prepared...");
      }

      try {
        PostingsList pl = env.getPostingsList(env.getTermFromId(i));
        PostingsReader reader = pl.getPostingsReader();

        int[] data = new int[pl.getDf()];
        int index = 0;
        while (reader.nextPosting(posting)) {
          data[index++] = newDocids[posting.getDocno()];
        }
        Arrays.sort(data);
        CompressedPostings compPostings = CompressedPostings.newInstance(data);
View Full Code Here

TOP

Related Classes of ivory.core.data.index.PostingsReader

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.