Search in sources :

Example 1 with SearchTarget

use of com.enonic.xp.node.SearchTarget in project xp by enonic.

the class FindNodesByMultiRepoQueryCommand method execute.

public FindNodesByMultiRepoQueryResult execute() {
    final SearchTargets searchTargets = query.getSearchTargets();
    final MultiRepoSearchSource.Builder searchSourceBuilder = MultiRepoSearchSource.create();
    for (final SearchTarget searchTarget : searchTargets) {
        searchSourceBuilder.add(SingleRepoSearchSource.create().branch(searchTarget.getBranch()).repositoryId(searchTarget.getRepositoryId()).acl(searchTarget.getPrincipalKeys()).build());
    }
    final SearchResult result = nodeSearchService.query(this.query.getNodeQuery(), searchSourceBuilder.build());
    return FindNodesByMultiRepoQueryResultFactory.create(result);
}
Also used : SearchTarget(com.enonic.xp.node.SearchTarget) MultiRepoSearchSource(com.enonic.xp.repo.impl.MultiRepoSearchSource) SearchResult(com.enonic.xp.repo.impl.search.result.SearchResult) SearchTargets(com.enonic.xp.node.SearchTargets)

Aggregations

SearchTarget (com.enonic.xp.node.SearchTarget)1 SearchTargets (com.enonic.xp.node.SearchTargets)1 MultiRepoSearchSource (com.enonic.xp.repo.impl.MultiRepoSearchSource)1 SearchResult (com.enonic.xp.repo.impl.search.result.SearchResult)1