Package com.kamikaze.docidset.impl

Examples of com.kamikaze.docidset.impl.IntArrayDocIdSet


public class FilterTest extends TestCase
{
  public void testFilterdDocSetIterator()
  {
    IntArrayDocIdSet set1 = new IntArrayDocIdSet();
    for (int i=0;i<100;++i)
    {
      set1.addDoc(2*i);         // 100 even numbers
    }
   
    DocIdSetIterator filteredIter = new FilteredDocSetIterator(set1.iterator())
    {

      @Override
      protected boolean match(int doc)
      {
View Full Code Here


          } else {
            return EmptyDocIdSet.getInstance();
          }        
        }       
        Collections.sort(docidList);       
        final IntArrayDocIdSet intArraySet = new IntArrayDocIdSet(docidList.size());
        boolean deletesPresent = delDocIds != null && delDocIds.length > 0;      
        for (int docid : docidList){
          if (!deletesPresent  || Arrays.binarySearch(delDocIds,docid) < 0) {
            intArraySet.addDoc(docid);           
          }
        }       
        return new RandomAccessDocIdSet(){
          @Override
          public boolean get(int docid) {
            return docidList.contains(docid);
          }

          @Override
          public DocIdSetIterator iterator() throws IOException {
            return intArraySet.iterator();
          }         
        };       
      }
    };
  }
View Full Code Here

  public static SenseiFilter buildFilter(final int... elems) {
    return new SenseiFilter() {
      @Override
      public SenseiDocIdSet getSenseiDocIdSet(IndexReader reader) throws IOException {
        IntArrayDocIdSet docIdSet = new IntArrayDocIdSet(elems.length);
        for(int elem : elems) {
          docIdSet.addDoc(elem);
        }

        return new SenseiDocIdSet(docIdSet, DocIdSetCardinality.exact(elems.length, reader.maxDoc()), "IntArray[" + elems.length + "]");
      }
    };
View Full Code Here

TOP

Related Classes of com.kamikaze.docidset.impl.IntArrayDocIdSet

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.