|
6 | 6 |
|
7 | 7 |
|
8 | 8 | import org.hibernate.search.engine.search.common.NonStaticMetamodelScope; |
9 | | -import org.hibernate.search.engine.search.predicate.dsl.SearchPredicateFactory; |
10 | | -import org.hibernate.search.engine.search.reference.sort.DistanceSortFieldReference; |
11 | | -import org.hibernate.search.engine.search.reference.sort.FieldSortFieldReference; |
12 | | -import org.hibernate.search.engine.spatial.GeoPoint; |
13 | | -import org.hibernate.search.util.common.SearchException; |
14 | 9 | import org.hibernate.search.util.common.annotation.Incubating; |
15 | 10 |
|
16 | 11 | /** |
|
44 | 39 | */ |
45 | 40 | public interface SearchSortFactory extends TypedSearchSortFactory<NonStaticMetamodelScope> { |
46 | 41 |
|
47 | | - /** |
48 | | - * Order elements by the value of a specific field. |
49 | | - * <p> |
50 | | - * The default order is <strong>ascending</strong>. |
51 | | - * |
52 | | - * @param fieldPath The <a href="#field-paths">path</a> to the index field to sort by. |
53 | | - * @return A DSL step where the "field" sort can be defined in more details. |
54 | | - * @throws SearchException If the field doesn't exist or cannot be sorted on. |
55 | | - */ |
56 | | - FieldSortOptionsStep<NonStaticMetamodelScope, ?, ? extends SearchPredicateFactory> field(String fieldPath); |
57 | | - |
58 | | - /** |
59 | | - * Order elements by the value of a specific field. |
60 | | - * <p> |
61 | | - * The default order is <strong>ascending</strong>. |
62 | | - * |
63 | | - * @param fieldReference The reference representing the <a href="#field-paths">path</a> to the index field to sort by. |
64 | | - * @return A DSL step where the "field" sort can be defined in more details. |
65 | | - * @throws SearchException If the field doesn't exist or cannot be sorted on. |
66 | | - */ |
67 | | - @Incubating |
68 | | - <T> FieldSortOptionsGenericStep<NonStaticMetamodelScope, T, ?, ?, ? extends SearchPredicateFactory> field( |
69 | | - FieldSortFieldReference<? super NonStaticMetamodelScope, T> fieldReference); |
70 | | - |
71 | | - /** |
72 | | - * Order elements by the distance from the location stored in the specified field to the location specified. |
73 | | - * <p> |
74 | | - * The default order is <strong>ascending</strong>. |
75 | | - * |
76 | | - * @param fieldPath The <a href="#field-paths">path</a> to the index field |
77 | | - * containing the location to compute the distance from. |
78 | | - * @param location The location to which we want to compute the distance. |
79 | | - * @return A DSL step where the "distance" sort can be defined in more details. |
80 | | - * @throws SearchException If the field type does not constitute a valid location. |
81 | | - */ |
82 | | - DistanceSortOptionsStep<NonStaticMetamodelScope, ?, ? extends SearchPredicateFactory> distance(String fieldPath, |
83 | | - GeoPoint location); |
84 | | - |
85 | | - /** |
86 | | - * Order elements by the distance from the location stored in the specified field to the location specified. |
87 | | - * <p> |
88 | | - * The default order is <strong>ascending</strong>. |
89 | | - * |
90 | | - * @param fieldReference The reference representing the <a href="#field-paths">path</a> to the index field |
91 | | - * containing the location to compute the distance from. |
92 | | - * @param location The location to which we want to compute the distance. |
93 | | - * @return A DSL step where the "distance" sort can be defined in more details. |
94 | | - * @throws SearchException If the field type does not constitute a valid location. |
95 | | - */ |
96 | | - @Incubating |
97 | | - default DistanceSortOptionsStep<NonStaticMetamodelScope, ?, ? extends SearchPredicateFactory> distance( |
98 | | - DistanceSortFieldReference<? super NonStaticMetamodelScope> fieldReference, GeoPoint location) { |
99 | | - return distance( fieldReference.absolutePath(), location ); |
100 | | - } |
101 | | - |
102 | | - /** |
103 | | - * Order elements by the distance from the location stored in the specified field to the location specified. |
104 | | - * <p> |
105 | | - * The default order is <strong>ascending</strong>. |
106 | | - * |
107 | | - * @param fieldPath The <a href="#field-paths">path</a> to the index field |
108 | | - * containing the location to compute the distance from. |
109 | | - * @param latitude The latitude of the location to which we want to compute the distance. |
110 | | - * @param longitude The longitude of the location to which we want to compute the distance. |
111 | | - * @return A DSL step where the "distance" sort can be defined in more details. |
112 | | - * @throws SearchException If the field type does not constitute a valid location. |
113 | | - */ |
114 | | - default DistanceSortOptionsStep<NonStaticMetamodelScope, ?, ? extends SearchPredicateFactory> distance(String fieldPath, |
115 | | - double latitude, |
116 | | - double longitude) { |
117 | | - return distance( fieldPath, GeoPoint.of( latitude, longitude ) ); |
118 | | - } |
119 | | - |
120 | | - /** |
121 | | - * Order elements by the distance from the location stored in the specified field to the location specified. |
122 | | - * <p> |
123 | | - * The default order is <strong>ascending</strong>. |
124 | | - * |
125 | | - * @param fieldReference The reference representing the <a href="#field-paths">path</a> to the index field |
126 | | - * containing the location to compute the distance from. |
127 | | - * @param latitude The latitude of the location to which we want to compute the distance. |
128 | | - * @param longitude The longitude of the location to which we want to compute the distance. |
129 | | - * @return A DSL step where the "distance" sort can be defined in more details. |
130 | | - * @throws SearchException If the field type does not constitute a valid location. |
131 | | - */ |
132 | | - @Incubating |
133 | | - default DistanceSortOptionsStep<NonStaticMetamodelScope, ?, ? extends SearchPredicateFactory> distance( |
134 | | - DistanceSortFieldReference<? super NonStaticMetamodelScope> fieldReference, double latitude, |
135 | | - double longitude) { |
136 | | - return distance( fieldReference, GeoPoint.of( latitude, longitude ) ); |
137 | | - } |
138 | | - |
139 | 42 | /** |
140 | 43 | * Create a new sort factory whose root for all paths passed to the DSL |
141 | 44 | * will be the given object field. |
|
0 commit comments