Coverage Report - org.apache.maven.index.AbstractSearchResponse
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractSearchResponse
90 %
10/11
N/A
1
 
 1  
 package org.apache.maven.index;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0    
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import java.io.Closeable;
 23  
 import java.io.IOException;
 24  
 
 25  
 import org.apache.lucene.search.Query;
 26  
 
 27  
 public class AbstractSearchResponse
 28  
     implements Closeable
 29  
 {
 30  
     private final Query query;
 31  
 
 32  
     private final int totalHitsCount;
 33  
 
 34  
     private final int returnedHitsCount;
 35  
 
 36  
     public AbstractSearchResponse( final Query query, final int totalHitsCount, final int returnedHitsCount )
 37  2643
     {
 38  2643
         this.query = query;
 39  
 
 40  2643
         this.totalHitsCount = totalHitsCount;
 41  
 
 42  2643
         this.returnedHitsCount = returnedHitsCount;
 43  2643
     }
 44  
 
 45  
     public Query getQuery()
 46  
     {
 47  18
         return query;
 48  
     }
 49  
 
 50  
     /**
 51  
      * Returns the number of total hits found. This may be different that actual hits returned (is usually more).
 52  
      * 
 53  
      * @return
 54  
      * @deprecated use {@link #getTotalHitsCount()} instead.
 55  
      */
 56  
     public int getTotalHits()
 57  
     {
 58  59
         return getTotalHitsCount();
 59  
     }
 60  
 
 61  
     /**
 62  
      * Returns the number of total hits found by this query (total number of potential hits as reported by Lucene
 63  
      * index). This is the number of existing AIs matching your query, and does not represent the count of hits
 64  
      * delivered, which is returned by {@link #getReturnedHitsCount()}.
 65  
      * 
 66  
      * @return
 67  
      */
 68  
     public int getTotalHitsCount()
 69  
     {
 70  159
         return totalHitsCount;
 71  
     }
 72  
 
 73  
     /**
 74  
      * Returns the number of hits returned by this search response. This number is affected by various input parameters
 75  
      * (like count set on request) and filtering, paging, etc. Warning: this number's meaning depends on actual search
 76  
      * response (for flat response number of actual AIs, for grouped response number of actual groups), and also, might
 77  
      * be not precise at all (see {@link IteratorSearchResponse}).
 78  
      * 
 79  
      * @return
 80  
      */
 81  
     public int getReturnedHitsCount()
 82  
     {
 83  2234
         return returnedHitsCount;
 84  
     }
 85  
 
 86  
     /**
 87  
      * Returns true if hit limit exceeded.
 88  
      * 
 89  
      * @return
 90  
      * @deprecated always returns false, since 4.1.0 there is no notion of hit limit
 91  
      * @see http://jira.codehaus.org/browse/MINDEXER-14
 92  
      */
 93  
     public boolean isHitLimitExceeded()
 94  
     {
 95  0
         return false;
 96  
     }
 97  
 
 98  
     /**
 99  
      * Frees any resource associated with this response. Should be called as last method on this response, when it's not
 100  
      * used anymore.
 101  
      * 
 102  
      * @throws IOException
 103  
      */
 104  
     public void close()
 105  
         throws IOException
 106  
     {
 107  
         // noop
 108  4
     }
 109  
 }