File tree Expand file tree Collapse file tree 8 files changed +89
-6
lines changed
Expand file tree Collapse file tree 8 files changed +89
-6
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
66
77## [ Unreleased]
88
9- - support ` overwriteMode ` values ` ignore ` and ` conflict ` (ArangoDB v3.7)
9+ - support for ` ArangoSearchProperties ` value ` primarySortCompression ` (ArangoDB v3.7)
10+ - support for ` overwriteMode ` values ` ignore ` and ` conflict ` (ArangoDB v3.7)
1011
1112## [ 6.6.3] - 2020-05-06
1213
Original file line number Diff line number Diff line change 1+ /*
2+ * DISCLAIMER
3+ *
4+ * Copyright 2016 ArangoDB GmbH, Cologne, Germany
5+ *
6+ * Licensed under the Apache License, Version 2.0 (the "License");
7+ * you may not use this file except in compliance with the License.
8+ * You may obtain a copy of the License at
9+ *
10+ * http://www.apache.org/licenses/LICENSE-2.0
11+ *
12+ * Unless required by applicable law or agreed to in writing, software
13+ * distributed under the License is distributed on an "AS IS" BASIS,
14+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+ * See the License for the specific language governing permissions and
16+ * limitations under the License.
17+ *
18+ * Copyright holder is ArangoDB GmbH, Cologne, Germany
19+ */
20+
21+ package com .arangodb .entity .arangosearch ;
22+
23+
24+ /**
25+ * @author Michele Rastelli
26+ */
27+ public enum ArangoSearchCompression {
28+ lz4 ("lz4" ),
29+ none ("none" );
30+
31+ private final String value ;
32+
33+ ArangoSearchCompression (String value ) {
34+ this .value = value ;
35+ }
36+
37+ public String getValue () {
38+ return value ;
39+ }
40+
41+ }
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ public class ArangoSearchProperties {
3636 private ConsolidationPolicy consolidationPolicy ;
3737 private final Collection <PrimarySort > primarySorts ;
3838 private final Collection <CollectionLink > links ;
39+ private ArangoSearchCompression primarySortCompression ;
3940
4041 public ArangoSearchProperties () {
4142 super ();
@@ -90,4 +91,13 @@ public Collection<PrimarySort> getPrimarySort() {
9091 public void addPrimarySort (final PrimarySort ... primarySorts ) {
9192 this .primarySorts .addAll (Arrays .asList (primarySorts ));
9293 }
94+
95+ public ArangoSearchCompression getPrimarySortCompression () {
96+ return primarySortCompression ;
97+ }
98+
99+ public void setPrimarySortCompression (ArangoSearchCompression primarySortCompression ) {
100+ this .primarySortCompression = primarySortCompression ;
101+ }
102+
93103}
Original file line number Diff line number Diff line change @@ -94,4 +94,12 @@ public Collection<CollectionLink> getLinks() {
9494 public Collection <PrimarySort > getPrimarySort () {
9595 return properties .getPrimarySort ();
9696 }
97+
98+ /**
99+ * @return how to compress the primary sort data
100+ */
101+ public ArangoSearchCompression getPrimarySortCompression () {
102+ return properties .getPrimarySortCompression ();
103+ }
104+
97105}
Original file line number Diff line number Diff line change @@ -200,6 +200,11 @@ public class VPackDeserializers {
200200 }
201201 }
202202
203+ final VPackSlice primarySortCompression = vpack .get ("primarySortCompression" );
204+ if (primarySortCompression .isString ()) {
205+ properties .setPrimarySortCompression (ArangoSearchCompression .valueOf (primarySortCompression .getAsString ()));
206+ }
207+
203208 return properties ;
204209 };
205210
Original file line number Diff line number Diff line change @@ -187,6 +187,12 @@ public class VPackSerializers {
187187 }
188188 builder .close (); // close array
189189 }
190+
191+ final ArangoSearchCompression primarySortCompression = value .getPrimarySortCompression ();
192+ if (primarySortCompression != null ) {
193+ builder .add ("primarySortCompression" , primarySortCompression .getValue ());
194+ }
195+
190196 };
191197
192198 private static void serializeFieldLinks (final VPackBuilder builder , final Collection <FieldLink > links ) {
Original file line number Diff line number Diff line change 2121package com .arangodb .model .arangosearch ;
2222
2323import com .arangodb .entity .ViewType ;
24- import com .arangodb .entity .arangosearch .ArangoSearchProperties ;
25- import com .arangodb .entity .arangosearch .CollectionLink ;
26- import com .arangodb .entity .arangosearch .ConsolidationPolicy ;
27- import com .arangodb .entity .arangosearch .PrimarySort ;
24+ import com .arangodb .entity .arangosearch .*;
2825
2926/**
3027 * @author Mark Vollmary
@@ -119,4 +116,14 @@ public ArangoSearchCreateOptions primarySort(final PrimarySort... primarySorts)
119116 properties .addPrimarySort (primarySorts );
120117 return this ;
121118 }
119+
120+ /**
121+ * @param primarySortCompression Defines how to compress the primary sort data
122+ * @return options
123+ */
124+ public ArangoSearchCreateOptions primarySortCompression (final ArangoSearchCompression primarySortCompression ) {
125+ properties .setPrimarySortCompression (primarySortCompression );
126+ return this ;
127+ }
128+
122129}
Original file line number Diff line number Diff line change @@ -133,14 +133,19 @@ public void createWithPrimarySort() {
133133 final PrimarySort primarySort = PrimarySort .on ("myFieldName" );
134134 primarySort .ascending (true );
135135 options .primarySort (primarySort );
136+ options .primarySortCompression (ArangoSearchCompression .none );
136137 options .consolidationIntervalMsec (666666L );
137138
138- final ViewEntity info = db .arangoSearch (viewName ).create (options );
139+ final ArangoSearch view = db .arangoSearch (viewName );
140+ final ViewEntity info = view .create (options );
139141 assertThat (info , is (not (nullValue ())));
140142 assertThat (info .getId (), is (not (nullValue ())));
141143 assertThat (info .getName (), is (viewName ));
142144 assertThat (info .getType (), is (ViewType .ARANGO_SEARCH ));
143145 assertThat (db .arangoSearch (viewName ).exists (), is (true ));
146+
147+ final ArangoSearchPropertiesEntity properties = view .getProperties ();
148+ assertThat (properties .getPrimarySortCompression (), is (ArangoSearchCompression .none ));
144149 }
145150
146151 @ Test
You can’t perform that action at this time.
0 commit comments