lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From molz <anmol.bha...@gmail.com>
Subject RE: kamikaze
Date Thu, 30 Apr 2009 02:58:15 GMT

  
Hi Michael,

2 Questions. 

1. What version of Kamikaze are you running with?
2. Can you try the snippet below and let me know if it fails ? I ran it 20
times and it did not fail. Maybe there is some difference in the utitlity
methods you have ? I am still trying to track down if anything is off at my
end but does not seem to be.

    public void testMultipleIntersections() 
    { 
            ArrayList<OpenBitSet> obs = new ArrayList<OpenBitSet>(); 
            ArrayList<DocIdSet> docs = new ArrayList<DocIdSet>(); 
        Random rand = new Random(System.currentTimeMillis()); 
            int maxDoc = 350000; 
            for(int i=0; i < 3; ++i) 
            { 
                    int numdocs = rand.nextInt(maxDoc); 
                    ArrayList<Integer> nums = new 
ArrayList<Integer>(); 
                    HashSet<Integer> seen = new HashSet<Integer>(); 
                    for (int j = 0; j < numdocs; j++) 
                { 
                            int nextDoc = rand.nextInt(maxDoc); 
                            if(seen.contains(nextDoc)) 
                            { 
                                    while(seen.contains(nextDoc)) 
                                    { 
                                            nextDoc = 
rand.nextInt(maxDoc); 
                                    } 
                            } 
                            nums.add(nextDoc); 
                            seen.add(nextDoc); 
                } 
                    Collections.sort(nums); 
                    obs.add(createObs(nums, maxDoc)); 
                    docs.add(createDocSet(nums)); 
            } 
            OpenBitSet base = obs.get(0); 
            for(int i = 1; i < obs.size(); ++i) 
            { 
                    base.intersect(obs.get(i)); 
            } 
            
            AndDocIdSet ands = new AndDocIdSet(docs); 
            long card1 = base.cardinality(); 
            long card2 = ands.size(); 
            System.out.println(card1+":"+card2);
            assertEquals(card1, card2); 
    } 


    private OpenBitSet createObs(ArrayList<Integer> nums, int maxDoc) {
      OpenBitSet bitSet = new OpenBitSet(maxDoc);
      for(int num:nums)
        bitSet.set(num);
      return bitSet;
    }
    
    private DocIdSet createDocSet(ArrayList<Integer> nums) {
      DocSet p4d = DocSetFactory.getDocSetInstance(0, 35000000, 200000,
          DocSetFactory.FOCUS.OPTIMAL);
      for(int num:nums)
       p4d.addDoc(num);
      return p4d;
    }

I even tried with the following 

  private DocIdSet createDocSet(ArrayList<Integer> nums) {
      P4DDocIdSet p4d = new P4DDocIdSet();
      for(int num:nums)
       p4d.addDoc(num);
      return p4d;
    }


 The NPE you mention in the previous emails has been identified as a bug and
will be fixed in the next release (in a day or two). 

Thanks,
Anmol


-- 
View this message in context: http://www.nabble.com/kamikaze-tp23224760p23307098.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message