Clover Coverage Report
Coverage timestamp: Fri May 9 2008 10:54:27 EST
../../../../img/srcFileCovDistChart7.png 63% of files have more coverage
111   316   51   4.11
46   203   0.46   13.5
27     1.89  
2    
 
  MultiSearcher       Line # 33 92 38 75% 0.75
  MultiSearcher.CachedDfSource       Line # 39 19 13 0% 0.0
 
  (25)
 
1    package org.apache.lucene.search;
2   
3    /**
4    * Copyright 2004 The Apache Software Foundation
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10    * http://www.apache.org/licenses/LICENSE-2.0
11    *
12    * Unless required by applicable law or agreed to in writing, software
13    * distributed under the License is distributed on an "AS IS" BASIS,
14    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15    * See the License for the specific language governing permissions and
16    * limitations under the License.
17    */
18   
19    import java.io.IOException;
20    import java.util.HashMap;
21    import java.util.HashSet;
22    import java.util.Map;
23    import java.util.Set;
24   
25    import org.apache.lucene.document.Document;
26    import org.apache.lucene.index.Term;
27   
28    /** Implements search over a set of <code>Searchables</code>.
29    *
30    * <p>Applications usually need only call the inherited {@link #search(Query)}
31    * or {@link #search(Query,Filter)} methods.
32    */
 
33    public class MultiSearcher extends Searcher {
34    /**
35    * Document Frequency cache acting as a Dummy-Searcher.
36    * This class is no full-fledged Searcher, but only supports
37    * the methods necessary to initialize Weights.
38    */
 
39    private static class CachedDfSource extends Searcher {
40    private Map dfMap; // Map from Terms to corresponding doc freqs
41    private int maxDoc; // document count
42   
 
43  0 toggle public CachedDfSource(Map dfMap, int maxDoc) {
44  0 this.dfMap = dfMap;
45  0 this.maxDoc = maxDoc;
46    }
47   
 
48  0 toggle public int docFreq(Term term) {
49  0 int df;
50  0 try {
51  0 df = ((Integer) dfMap.get(term)).intValue();
52    } catch (NullPointerException e) {
53  0 throw new IllegalArgumentException("df for term " + term.text()
54    + " not available");
55    }
56  0 return df;
57    }
58   
 
59  0 toggle public int[] docFreqs(Term[] terms) {
60  0 int[] result = new int[terms.length];
61  0 for (int i = 0; i < terms.length; i++) {
62  0 result[i] = docFreq(terms[i]);
63    }
64  0 return result;
65    }
66