public QryResult evaluateBoolean (RetrievalModel r) throws IOException {

    //  Initialization

    allocDaaTPtrs (r);
    QryResult result = new QryResult ();

    //  Sort the arguments so that the shortest lists are first.  This
    //  improves the efficiency of exact-match OR without changing
    //  the result.

    for (int i=0; i<(this.daatPtrs.size()-1); i++) {
    	for (int j=i+1; j<this.daatPtrs.size(); j++) {
    		if (this.daatPtrs.get(i).scoreList.scores.size() > this.daatPtrs.get(j).scoreList.scores.size()) {
		    ScoreList tmpScoreList = this.daatPtrs.get(i).scoreList;
		    this.daatPtrs.get(i).scoreList = this.daatPtrs.get(j).scoreList;
		    this.daatPtrs.get(j).scoreList = tmpScoreList;
	}
      }
    }
    
    // take the longest list  i.e. the last one in the array.
    DaaTPtr ptr0 = this.daatPtrs.get(this.daatPtrs.size()-1);
    
    // The TreeSet will store docids. So, it will be sorted and duplicates will be removed automatically. 
    TreeSet<Integer> ts = new TreeSet<Integer>();
    double docScore = 1.0;
    
    // This is a term at a time kind of implementation. Take the doc id and put into a tree set
   
    for ( ; ptr0.nextDoc < ptr0.scoreList.scores.size(); ptr0.nextDoc ++) {

      int ptr0Docid = ptr0.scoreList.getDocid (ptr0.nextDoc);

      ts.add(ptr0Docid);
      
      for (int j=this.daatPtrs.size()-2; j >=0; j--) {

    	  DaaTPtr ptrj = this.daatPtrs.get(j);
    	  
    	  if (ptrj.nextDoc < ptr0.scoreList.scores.size() && ptrj.nextDoc <  ptrj.scoreList.scores.size() )
    	  {
    		  ts.add(ptrj.scoreList.getDocid (ptrj.nextDoc));  // add the docid to the treeSet
    		  ptrj.nextDoc++;	 
    	  }  			
      }
      
    }

    // Add the sorted docids to docScores.
    for (Integer docids : ts)
    {
    	result.docScores.add (docids.intValue(), docScore);
    }
    
    freeDaaTPtrs ();

    return result;
  }