1 package org.apache.archiva.indexer.maven.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 org.apache.archiva.indexer.UnsupportedBaseContextException;
23 import org.apache.archiva.indexer.search.ArtifactInfoFilter;
24 import org.apache.archiva.indexer.search.NoClassifierArtifactInfoFilter;
25 import org.apache.archiva.indexer.search.RepositorySearch;
26 import org.apache.archiva.indexer.search.RepositorySearchException;
27 import org.apache.archiva.indexer.search.SearchFields;
28 import org.apache.archiva.indexer.search.SearchResultHit;
29 import org.apache.archiva.indexer.search.SearchResultLimits;
30 import org.apache.archiva.indexer.search.SearchResults;
31 import org.apache.archiva.indexer.util.SearchUtil;
32 import org.apache.archiva.model.ArchivaArtifactModel;
33 import org.apache.archiva.proxy.ProxyRegistry;
34 import org.apache.archiva.proxy.model.ProxyConnector;
35 import org.apache.archiva.repository.RemoteRepository;
36 import org.apache.archiva.repository.Repository;
37 import org.apache.archiva.repository.RepositoryRegistry;
38 import org.apache.archiva.repository.RepositoryType;
39 import org.apache.commons.lang3.StringUtils;
40 import org.apache.maven.index.ArtifactInfo;
41 import org.apache.maven.index.FlatSearchRequest;
42 import org.apache.maven.index.FlatSearchResponse;
43 import org.apache.maven.index.Indexer;
44 import org.apache.maven.index.MAVEN;
45 import org.apache.maven.index.OSGI;
46 import org.apache.maven.index.QueryCreator;
47 import org.apache.maven.index.SearchType;
48 import org.apache.maven.index.context.IndexingContext;
49 import org.apache.maven.index.expr.SearchExpression;
50 import org.apache.maven.index.expr.SearchTyped;
51 import org.apache.maven.index.expr.SourcedSearchExpression;
52 import org.apache.maven.index.expr.UserInputSearchExpression;
53 import org.apache.maven.index_shaded.lucene.search.BooleanClause;
54 import org.apache.maven.index_shaded.lucene.search.BooleanClause.Occur;
55 import org.apache.maven.index_shaded.lucene.search.BooleanQuery;
56 import org.slf4j.Logger;
57 import org.slf4j.LoggerFactory;
58 import org.springframework.stereotype.Service;
60 import javax.inject.Inject;
61 import java.io.IOException;
62 import java.util.ArrayList;
63 import java.util.Collection;
64 import java.util.Collections;
65 import java.util.HashSet;
66 import java.util.List;
71 * RepositorySearch implementation which uses the Maven Indexer for searching.
73 @Service( "repositorySearch#maven" )
74 public class MavenRepositorySearch
75 implements RepositorySearch
77 private Logger log = LoggerFactory.getLogger( getClass() );
79 private Indexer indexer;
81 private QueryCreator queryCreator;
84 private RepositoryRegistry repositoryRegistry;
86 private ProxyRegistry proxyRegistry;
88 protected MavenRepositorySearch()
94 public MavenRepositorySearch( Indexer nexusIndexer, RepositoryRegistry repositoryRegistry,
95 ProxyRegistry proxyRegistry, QueryCreator queryCreator )
97 this.indexer = nexusIndexer;
98 this.queryCreator = queryCreator;
99 this.repositoryRegistry = repositoryRegistry;
100 this.proxyRegistry = proxyRegistry;
104 * @see RepositorySearch#search(String, List, String, SearchResultLimits, List)
107 public SearchResults search(String principal, List<String> selectedRepos, String term, SearchResultLimits limits,
108 List<String> previousSearchTerms )
109 throws RepositorySearchException
111 List<String> indexingContextIds = addIndexingContexts( selectedRepos );
113 // since upgrade to nexus 2.0.0, query has changed from g:[QUERIED TERM]* to g:*[QUERIED TERM]*
114 // resulting to more wildcard searches so we need to increase max clause count
115 BooleanQuery.setMaxClauseCount( Integer.MAX_VALUE );
116 BooleanQuery.Builder qb = new BooleanQuery.Builder();
118 if ( previousSearchTerms == null || previousSearchTerms.isEmpty() )
120 constructQuery( term, qb );
124 for ( String previousTerm : previousSearchTerms )
126 BooleanQuery.Builder iQuery = new BooleanQuery.Builder();
127 constructQuery( previousTerm, iQuery );
129 qb.add( iQuery.build(), BooleanClause.Occur.MUST );
132 BooleanQuery.Builder iQuery = new BooleanQuery.Builder();
133 constructQuery( term, iQuery );
134 qb.add( iQuery.build(), BooleanClause.Occur.MUST );
137 // we retun only artifacts without classifier in quick search, olamy cannot find a way to say with this field empty
138 // FIXME cannot find a way currently to setup this in constructQuery !!!
139 return search( limits, qb.build(), indexingContextIds, NoClassifierArtifactInfoFilter.LIST, selectedRepos, true );
144 * @see RepositorySearch#search(String, SearchFields, SearchResultLimits)
146 @SuppressWarnings( "deprecation" )
148 public SearchResults search( String principal, SearchFields searchFields, SearchResultLimits limits )
149 throws RepositorySearchException
151 if ( searchFields.getRepositories() == null )
153 throw new RepositorySearchException( "Repositories cannot be null." );
156 List<String> indexingContextIds = addIndexingContexts( searchFields.getRepositories() );
158 // if no index found in the specified ones return an empty search result instead of doing a search on all index
159 // olamy: IMHO doesn't make sense
160 if ( !searchFields.getRepositories().isEmpty() && ( indexingContextIds == null
161 || indexingContextIds.isEmpty() ) )
163 return new SearchResults();
166 BooleanQuery.Builder qb = new BooleanQuery.Builder();
167 if ( StringUtils.isNotBlank( searchFields.getGroupId() ) )
169 qb.add( indexer.constructQuery( MAVEN.GROUP_ID, searchFields.isExactSearch() ? new SourcedSearchExpression(
170 searchFields.getGroupId() ) : new UserInputSearchExpression( searchFields.getGroupId() ) ),
171 BooleanClause.Occur.MUST );
174 if ( StringUtils.isNotBlank( searchFields.getArtifactId() ) )
176 qb.add( indexer.constructQuery( MAVEN.ARTIFACT_ID,
177 searchFields.isExactSearch()
178 ? new SourcedSearchExpression( searchFields.getArtifactId() )
179 : new UserInputSearchExpression( searchFields.getArtifactId() ) ),
180 BooleanClause.Occur.MUST );
183 if ( StringUtils.isNotBlank( searchFields.getVersion() ) )
185 qb.add( indexer.constructQuery( MAVEN.VERSION, searchFields.isExactSearch() ? new SourcedSearchExpression(
186 searchFields.getVersion() ) : new SourcedSearchExpression( searchFields.getVersion() ) ),
187 BooleanClause.Occur.MUST );
190 if ( StringUtils.isNotBlank( searchFields.getPackaging() ) )
192 qb.add( indexer.constructQuery( MAVEN.PACKAGING, searchFields.isExactSearch() ? new SourcedSearchExpression(
193 searchFields.getPackaging() ) : new UserInputSearchExpression( searchFields.getPackaging() ) ),
194 BooleanClause.Occur.MUST );
197 if ( StringUtils.isNotBlank( searchFields.getClassName() ) )
199 qb.add( indexer.constructQuery( MAVEN.CLASSNAMES,
200 new UserInputSearchExpression( searchFields.getClassName() ) ),
201 BooleanClause.Occur.MUST );
204 if ( StringUtils.isNotBlank( searchFields.getBundleSymbolicName() ) )
206 qb.add( indexer.constructQuery( OSGI.SYMBOLIC_NAME,
207 new UserInputSearchExpression( searchFields.getBundleSymbolicName() ) ),
208 BooleanClause.Occur.MUST );
211 if ( StringUtils.isNotBlank( searchFields.getBundleVersion() ) )
213 qb.add( indexer.constructQuery( OSGI.VERSION,
214 new UserInputSearchExpression( searchFields.getBundleVersion() ) ),
215 BooleanClause.Occur.MUST );
218 if ( StringUtils.isNotBlank( searchFields.getBundleExportPackage() ) )
220 qb.add( indexer.constructQuery( OSGI.EXPORT_PACKAGE,
221 new UserInputSearchExpression( searchFields.getBundleExportPackage() ) ),
225 if ( StringUtils.isNotBlank( searchFields.getBundleExportService() ) )
227 qb.add( indexer.constructQuery( OSGI.EXPORT_SERVICE,
228 new UserInputSearchExpression( searchFields.getBundleExportService() ) ),
232 if ( StringUtils.isNotBlank( searchFields.getBundleImportPackage() ) )
234 qb.add( indexer.constructQuery( OSGI.IMPORT_PACKAGE,
235 new UserInputSearchExpression( searchFields.getBundleImportPackage() ) ),
239 if ( StringUtils.isNotBlank( searchFields.getBundleName() ) )
241 qb.add( indexer.constructQuery( OSGI.NAME, new UserInputSearchExpression( searchFields.getBundleName() ) ),
245 if ( StringUtils.isNotBlank( searchFields.getBundleImportPackage() ) )
247 qb.add( indexer.constructQuery( OSGI.IMPORT_PACKAGE,
248 new UserInputSearchExpression( searchFields.getBundleImportPackage() ) ),
252 if ( StringUtils.isNotBlank( searchFields.getBundleRequireBundle() ) )
254 qb.add( indexer.constructQuery( OSGI.REQUIRE_BUNDLE,
255 new UserInputSearchExpression( searchFields.getBundleRequireBundle() ) ),
259 if ( StringUtils.isNotBlank( searchFields.getClassifier() ) )
261 qb.add( indexer.constructQuery( MAVEN.CLASSIFIER, searchFields.isExactSearch() ? new SourcedSearchExpression(
262 searchFields.getClassifier() ) : new UserInputSearchExpression( searchFields.getClassifier() ) ),
265 else if ( searchFields.isExactSearch() )
267 //TODO improvement in case of exact search and no classifier we must query for classifier with null value
268 // currently it's done in DefaultSearchService with some filtering
271 BooleanQuery qu = qb.build();
272 if ( qu.clauses() == null || qu.clauses().size() <= 0 )
274 throw new RepositorySearchException( "No search fields set." );
276 if (qu.clauses()!=null) {
277 log.debug("CLAUSES ", qu.clauses());
278 for (BooleanClause cl : qu.clauses()) {
279 log.debug("Clause ",cl);
283 return search( limits, qu, indexingContextIds, Collections.<ArtifactInfoFilter>emptyList(),
284 searchFields.getRepositories(), searchFields.isIncludePomArtifacts() );
287 private static class NullSearch
288 implements SearchTyped, SearchExpression
290 private static final NullSearch INSTANCE = new NullSearch();
293 public String getStringValue()
295 return "[[NULL_VALUE]]";
299 public SearchType getSearchType()
301 return SearchType.EXACT;
305 private SearchResults search( SearchResultLimits limits, BooleanQuery q, List<String> indexingContextIds,
306 List<? extends ArtifactInfoFilter> filters, List<String> selectedRepos,
307 boolean includePoms )
308 throws RepositorySearchException
313 FlatSearchRequest request = new FlatSearchRequest( q );
315 request.setContexts( getIndexingContexts( indexingContextIds ) );
316 if ( limits != null )
318 // we apply limits only when first page asked
319 if ( limits.getSelectedPage() == 0 )
321 request.setCount( limits.getPageSize() * ( Math.max( 1, limits.getSelectedPage() ) ) );
325 FlatSearchResponse response = indexer.searchFlat( request );
327 if ( response == null || response.getTotalHitsCount() == 0 )
329 SearchResults results = new SearchResults();
330 results.setLimits( limits );
334 return convertToSearchResults( response, limits, filters, selectedRepos, includePoms );
336 catch ( IOException e )
338 throw new RepositorySearchException( e.getMessage(), e );
343 private IndexingContext getIndexingContext(String id) {
345 if (StringUtils.startsWith(id, "remote-")) {
346 repoId = StringUtils.substringAfter(id, "remote-");
350 Repository repo = repositoryRegistry.getRepository(repoId);
354 if (repo.getIndexingContext()!=null) {
356 return repo.getIndexingContext().getBaseContext(IndexingContext.class);
357 } catch (UnsupportedBaseContextException e) {
366 private List<IndexingContext> getIndexingContexts( List<String> ids )
368 List<IndexingContext> contexts = new ArrayList<>( ids.size() );
370 for ( String id : ids )
372 IndexingContext context = getIndexingContext(id);
373 if ( context != null )
375 contexts.add( context );
379 log.warn( "context with id {} not exists", id );
386 private void constructQuery( String term, BooleanQuery.Builder q )
388 q.add( indexer.constructQuery( MAVEN.GROUP_ID, new UserInputSearchExpression( term ) ), Occur.SHOULD );
389 q.add( indexer.constructQuery( MAVEN.ARTIFACT_ID, new UserInputSearchExpression( term ) ), Occur.SHOULD );
390 q.add( indexer.constructQuery( MAVEN.VERSION, new UserInputSearchExpression( term ) ), Occur.SHOULD );
391 q.add( indexer.constructQuery( MAVEN.PACKAGING, new UserInputSearchExpression( term ) ), Occur.SHOULD );
392 q.add( indexer.constructQuery( MAVEN.CLASSNAMES, new UserInputSearchExpression( term ) ), Occur.SHOULD );
395 // new WildcardQuery( new Term( MAVEN.CLASSNAMES.getFieldName(), "*" ) );
396 //q.add( query, Occur.MUST_NOT );
397 // olamy IMHO we could set this option as at least one must match
398 //q.setMinimumNumberShouldMatch( 1 );
403 * @param selectedRepos
404 * @return indexing contextId used
406 private List<String> addIndexingContexts( List<String> selectedRepos )
408 Set<String> indexingContextIds = new HashSet<>();
409 for ( String repo : selectedRepos )
413 Repository rRepo = repositoryRegistry.getRepository(repo);
418 if (rRepo.getType().equals(RepositoryType.MAVEN)) {
419 assert rRepo.getIndexingContext() != null;
420 IndexingContext context = rRepo.getIndexingContext().getBaseContext(IndexingContext.class);
421 if (context.isSearchable()) {
422 indexingContextIds.addAll(getRemoteIndexingContextIds(repo));
423 indexingContextIds.add(context.getId());
425 log.warn("indexingContext with id {} not searchable", rRepo.getId());
432 log.warn( "Repository '{}' not found in configuration.", repo );
435 catch ( RepositorySearchException e )
437 log.warn( "RepositorySearchException occured while accessing index of repository '{}' : {}", repo,
440 } catch (UnsupportedBaseContextException e) {
441 log.error("Fatal situation: Maven repository without IndexingContext found.");
446 return new ArrayList<>( indexingContextIds );
451 public Set<String> getRemoteIndexingContextIds( String managedRepoId )
452 throws RepositorySearchException
454 Set<String> ids = new HashSet<>();
456 List<ProxyConnector> proxyConnectors = null;
457 proxyConnectors = proxyRegistry.getProxyConnectorAsMap( ).get( managedRepoId );
459 if ( proxyConnectors == null || proxyConnectors.isEmpty() )
464 for ( ProxyConnector proxyConnector : proxyConnectors )
466 String remoteId = "remote-" + proxyConnector.getTargetRepository().getId();
467 RemoteRepository repo = repositoryRegistry.getRemoteRepository(proxyConnector.getTargetRepository().getId());
468 if (repo.getType()==RepositoryType.MAVEN) {
470 IndexingContext context = repo.getIndexingContext() != null ? repo.getIndexingContext().getBaseContext(IndexingContext.class) : null;
471 if (context!=null && context.isSearchable()) {
474 } catch (UnsupportedBaseContextException e) {
484 public Collection<String> getAllGroupIds( String principal, List<String> selectedRepos )
485 throws RepositorySearchException
487 List<IndexingContext> indexContexts = getIndexingContexts( selectedRepos );
489 if ( indexContexts == null || indexContexts.isEmpty() )
491 return Collections.emptyList();
496 Set<String> allGroupIds = new HashSet<>();
497 for ( IndexingContext indexingContext : indexContexts )
499 allGroupIds.addAll( indexingContext.getAllGroups() );
503 catch ( IOException e )
505 throw new RepositorySearchException( e.getMessage(), e );
510 private SearchResults convertToSearchResults( FlatSearchResponse response, SearchResultLimits limits,
511 List<? extends ArtifactInfoFilter> artifactInfoFilters,
512 List<String> selectedRepos, boolean includePoms )
514 SearchResults results = new SearchResults();
515 Set<ArtifactInfo> artifactInfos = response.getResults();
517 for ( ArtifactInfo artifactInfo : artifactInfos )
519 if ( StringUtils.equalsIgnoreCase( "pom", artifactInfo.getFileExtension() ) && !includePoms )
523 String id = SearchUtil.getHitId( artifactInfo.getGroupId(), //
524 artifactInfo.getArtifactId(), //
525 artifactInfo.getClassifier(), //
526 artifactInfo.getPackaging() );
527 Map<String, SearchResultHit> hitsMap = results.getHitsMap();
530 if ( !applyArtifactInfoFilters( artifactInfo, artifactInfoFilters, hitsMap ) )
535 SearchResultHit hit = hitsMap.get( id );
538 if ( !hit.getVersions().contains( artifactInfo.getVersion() ) )
540 hit.addVersion( artifactInfo.getVersion() );
545 hit = new SearchResultHit();
546 hit.setArtifactId( artifactInfo.getArtifactId() );
547 hit.setGroupId( artifactInfo.getGroupId() );
548 hit.setRepositoryId( artifactInfo.getRepository() );
549 hit.addVersion( artifactInfo.getVersion() );
550 hit.setBundleExportPackage( artifactInfo.getBundleExportPackage() );
551 hit.setBundleExportService( artifactInfo.getBundleExportService() );
552 hit.setBundleSymbolicName( artifactInfo.getBundleSymbolicName() );
553 hit.setBundleVersion( artifactInfo.getBundleVersion() );
554 hit.setBundleDescription( artifactInfo.getBundleDescription() );
555 hit.setBundleDocUrl( artifactInfo.getBundleDocUrl() );
556 hit.setBundleRequireBundle( artifactInfo.getBundleRequireBundle() );
557 hit.setBundleImportPackage( artifactInfo.getBundleImportPackage() );
558 hit.setBundleLicense( artifactInfo.getBundleLicense() );
559 hit.setBundleName( artifactInfo.getBundleName() );
560 hit.setContext( artifactInfo.getContext() );
561 hit.setGoals( artifactInfo.getGoals() );
562 hit.setPrefix( artifactInfo.getPrefix() );
563 hit.setPackaging( artifactInfo.getPackaging() );
564 hit.setClassifier( artifactInfo.getClassifier() );
565 hit.setFileExtension( artifactInfo.getFileExtension() );
566 hit.setUrl( getBaseUrl( artifactInfo, selectedRepos ) );
569 results.addHit( id, hit );
572 results.setTotalHits( response.getTotalHitsCount() );
573 results.setTotalHitsMapSize( results.getHitsMap().values().size() );
574 results.setReturnedHitsCount( response.getReturnedHitsCount() );
575 results.setLimits( limits );
577 if ( limits == null || limits.getSelectedPage() == SearchResultLimits.ALL_PAGES )
583 return paginate( results );
588 * calculate baseUrl without the context and base Archiva Url
590 * @param artifactInfo
593 protected String getBaseUrl( ArtifactInfo artifactInfo, List<String> selectedRepos )
595 StringBuilder sb = new StringBuilder();
596 if ( StringUtils.startsWith( artifactInfo.getContext(), "remote-" ) )
598 // it's a remote index result we search a managed which proxying this remote and on which
599 // current user has read karma
600 String managedRepoId =
601 getManagedRepoId( StringUtils.substringAfter( artifactInfo.getContext(), "remote-" ), selectedRepos );
602 if ( managedRepoId != null )
604 sb.append( '/' ).append( managedRepoId );
605 artifactInfo.setContext( managedRepoId );
610 sb.append( '/' ).append( artifactInfo.getContext() );
613 sb.append( '/' ).append( StringUtils.replaceChars( artifactInfo.getGroupId(), '.', '/' ) );
614 sb.append( '/' ).append( artifactInfo.getArtifactId() );
615 sb.append( '/' ).append( artifactInfo.getVersion() );
616 sb.append( '/' ).append( artifactInfo.getArtifactId() );
617 sb.append( '-' ).append( artifactInfo.getVersion() );
618 if ( StringUtils.isNotBlank( artifactInfo.getClassifier() ) )
620 sb.append( '-' ).append( artifactInfo.getClassifier() );
622 // maven-plugin packaging is a jar
623 if ( StringUtils.equals( "maven-plugin", artifactInfo.getPackaging() ) )
629 sb.append( '.' ).append( artifactInfo.getPackaging() );
632 return sb.toString();
636 * return a managed repo for a remote result
639 * @param selectedRepos
642 private String getManagedRepoId( String remoteRepo, List<String> selectedRepos )
644 Map<String, List<ProxyConnector>> proxyConnectorMap = proxyRegistry.getProxyConnectorAsMap();
645 if ( proxyConnectorMap == null || proxyConnectorMap.isEmpty() )
649 if ( selectedRepos != null && !selectedRepos.isEmpty() )
651 for ( Map.Entry<String, List<ProxyConnector>> entry : proxyConnectorMap.entrySet() )
653 if ( selectedRepos.contains( entry.getKey() ) )
655 for ( ProxyConnector proxyConnector : entry.getValue() )
657 if ( StringUtils.equals( remoteRepo, proxyConnector.getTargetRepository().getId() ) )
659 return proxyConnector.getSourceRepository().getId();
666 // we don't find in search selected repos so return the first one
667 for ( Map.Entry<String, List<ProxyConnector>> entry : proxyConnectorMap.entrySet() )
670 for ( ProxyConnector proxyConnector : entry.getValue() )
672 if ( StringUtils.equals( remoteRepo, proxyConnector.getTargetRepository().getId() ) )
674 return proxyConnector.getSourceRepository().getId();
682 private boolean applyArtifactInfoFilters( ArtifactInfo artifactInfo,
683 List<? extends ArtifactInfoFilter> artifactInfoFilters,
684 Map<String, SearchResultHit> currentResult )
686 if ( artifactInfoFilters == null || artifactInfoFilters.isEmpty() )
691 ArchivaArtifactModel artifact = new ArchivaArtifactModel();
692 artifact.setArtifactId( artifactInfo.getArtifactId() );
693 artifact.setClassifier( artifactInfo.getClassifier() );
694 artifact.setGroupId( artifactInfo.getGroupId() );
695 artifact.setRepositoryId( artifactInfo.getRepository() );
696 artifact.setVersion( artifactInfo.getVersion() );
697 artifact.setChecksumMD5( artifactInfo.getMd5() );
698 artifact.setChecksumSHA1( artifactInfo.getSha1() );
699 for ( ArtifactInfoFilter filter : artifactInfoFilters )
701 if ( !filter.addArtifactInResult( artifact, currentResult ) )
709 protected SearchResults paginate( SearchResults results )
711 SearchResultLimits limits = results.getLimits();
712 SearchResults paginated = new SearchResults();
714 // ( limits.getPageSize() * ( Math.max( 1, limits.getSelectedPage() ) ) );
716 int fetchCount = limits.getPageSize();
717 int offset = ( limits.getSelectedPage() * limits.getPageSize() );
719 if ( fetchCount > results.getTotalHits() )
721 fetchCount = results.getTotalHits();
725 if ( offset < results.getTotalHits() )
727 // only process if the offset is within the hit count.
728 for ( int i = 0; i < fetchCount; i++ )
730 // Stop fetching if we are past the total # of available hits.
731 if ( offset + i >= results.getHits().size() )
736 SearchResultHit hit = results.getHits().get( ( offset + i ) );
739 String id = SearchUtil.getHitId( hit.getGroupId(), hit.getArtifactId(), hit.getClassifier(),
740 hit.getPackaging() );
741 paginated.addHit( id, hit );
749 paginated.setTotalHits( results.getTotalHits() );
750 paginated.setReturnedHitsCount( paginated.getHits().size() );
751 paginated.setTotalHitsMapSize( results.getTotalHitsMapSize() );
752 paginated.setLimits( limits );