1 package org.apache.archiva.indexer.search;
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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
22 import java.util.ArrayList;
23 import java.util.HashMap;
24 import java.util.List;
32 public class SearchResults
34 private Map<String, SearchResultHit> hits = new HashMap<>();
36 private int totalHits;
38 private int totalHitsMapSize;
40 private int returnedHitsCount;
42 private SearchResultLimits limits;
44 public SearchResults()
49 // for new RepositorySearch
50 public void addHit( String id, SearchResultHit hit )
56 * Get the list of {@link SearchResultHit} objects.
58 * @return the list of {@link SearchResultHit} objects.
60 public List<SearchResultHit> getHits()
62 return new ArrayList<>( hits.values() );
66 * see SearchUtil on how to generate the key
71 public SearchResultHit getSearchResultHit( String key )
73 return hits.get( key );
76 public Map<String, SearchResultHit> getHitsMap()
81 public boolean isEmpty()
83 return hits.isEmpty();
86 public SearchResultLimits getLimits()
91 public void setLimits( SearchResultLimits limits )
96 public int getTotalHits()
101 public void setTotalHits( int totalHits )
103 this.totalHits = totalHits;
110 public int getReturnedHitsCount()
112 return returnedHitsCount;
116 * @param returnedHitsCount
119 public void setReturnedHitsCount( int returnedHitsCount )
121 this.returnedHitsCount = returnedHitsCount;
128 public int getTotalHitsMapSize()
130 return totalHitsMapSize;
134 * @param totalHitsMapSize
137 public void setTotalHitsMapSize( int totalHitsMapSize )
139 this.totalHitsMapSize = totalHitsMapSize;
143 public String toString()
145 return "SearchResults{" + "hits=" + hits + ", totalHits=" + totalHits + ", returnedHitsCount="
146 + returnedHitsCount + ", limits=" + limits + '}';