-
Notifications
You must be signed in to change notification settings - Fork 243
/
MappedIndexScopeImpl.java
73 lines (63 loc) · 2.92 KB
/
MappedIndexScopeImpl.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
* Hibernate Search, full-text search for your domain model
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.search.engine.common.impl;
import org.hibernate.search.engine.mapper.scope.spi.MappedIndexScope;
import org.hibernate.search.engine.mapper.session.context.spi.SessionContextImplementor;
import org.hibernate.search.engine.search.aggregation.dsl.SearchAggregationFactory;
import org.hibernate.search.engine.search.aggregation.dsl.impl.DefaultSearchAggregationFactory;
import org.hibernate.search.engine.search.aggregation.dsl.impl.SearchAggregationDslContextImpl;
import org.hibernate.search.engine.search.dsl.predicate.SearchPredicateFactory;
import org.hibernate.search.engine.search.dsl.predicate.impl.DefaultSearchPredicateFactory;
import org.hibernate.search.engine.search.dsl.projection.SearchProjectionFactory;
import org.hibernate.search.engine.search.dsl.projection.impl.DefaultSearchProjectionFactory;
import org.hibernate.search.engine.search.dsl.query.SearchQueryHitTypeStep;
import org.hibernate.search.engine.search.dsl.query.impl.DefaultSearchQueryHitTypeStep;
import org.hibernate.search.engine.search.dsl.sort.SearchSortFactory;
import org.hibernate.search.engine.search.dsl.sort.impl.DefaultSearchSortFactory;
import org.hibernate.search.engine.search.dsl.sort.impl.SearchSortDslContextImpl;
import org.hibernate.search.engine.backend.scope.spi.IndexScope;
import org.hibernate.search.engine.search.loading.context.spi.LoadingContextBuilder;
class MappedIndexScopeImpl<C, R, E> implements MappedIndexScope<R, E> {
private final IndexScope<C> delegate;
MappedIndexScopeImpl(IndexScope<C> delegate) {
this.delegate = delegate;
}
@Override
public String toString() {
return new StringBuilder( getClass().getSimpleName() )
.append( "[" )
.append( "delegate=" ).append( delegate )
.append( "]" )
.toString();
}
@Override
public SearchQueryHitTypeStep<?, R, E, SearchProjectionFactory<R, E>, ?> search(
SessionContextImplementor sessionContext,
LoadingContextBuilder<R, E> loadingContextBuilder) {
return new DefaultSearchQueryHitTypeStep<>( delegate, sessionContext, loadingContextBuilder );
}
@Override
public SearchPredicateFactory predicate() {
return new DefaultSearchPredicateFactory<>( delegate.getSearchPredicateBuilderFactory() );
}
@Override
public SearchSortFactory sort() {
return new DefaultSearchSortFactory<>(
SearchSortDslContextImpl.root( delegate.getSearchSortBuilderFactory() )
);
}
@Override
public SearchProjectionFactory<R, E> projection() {
return new DefaultSearchProjectionFactory<>( delegate.getSearchProjectionFactory() );
}
@Override
public SearchAggregationFactory aggregation() {
return new DefaultSearchAggregationFactory(
SearchAggregationDslContextImpl.root( delegate.getSearchAggregationFactory() )
);
}
}