22
22
23
23
import com .arangodb .entity .IndexType ;
24
24
25
+ import java .util .Collection ;
26
+ import java .util .Collections ;
27
+ import java .util .HashSet ;
28
+
25
29
/**
26
30
* @author Mark Vollmary
27
31
* @see <a href="https://www.arangodb.com/docs/stable/http/indexes-persistent.html#create-a-persistent-index">API
@@ -36,6 +40,7 @@ public class PersistentIndexOptions extends IndexOptions<PersistentIndexOptions>
36
40
private Boolean deduplicate ;
37
41
private Boolean estimates ;
38
42
private Boolean cacheEnabled ;
43
+ private Collection <String > storedValues ;
39
44
40
45
public PersistentIndexOptions () {
41
46
super ();
@@ -81,8 +86,7 @@ public Boolean getSparse() {
81
86
}
82
87
83
88
/**
84
- * @param sparse
85
- * if true, then create a sparse index
89
+ * @param sparse if true, then create a sparse index
86
90
* @return options
87
91
*/
88
92
public PersistentIndexOptions sparse (final Boolean sparse ) {
@@ -95,8 +99,7 @@ public Boolean getDeduplicate() {
95
99
}
96
100
97
101
/**
98
- * @param deduplicate
99
- * if false, the deduplication of array values is turned off. Default: {@code true}
102
+ * @param deduplicate if false, the deduplication of array values is turned off. Default: {@code true}
100
103
* @return options
101
104
*/
102
105
public PersistentIndexOptions deduplicate (final Boolean deduplicate ) {
@@ -105,9 +108,9 @@ public PersistentIndexOptions deduplicate(final Boolean deduplicate) {
105
108
}
106
109
107
110
/**
108
- * @param estimates
109
- * This attribute controls whether index selectivity estimates are maintained for the index. Default: {@code
110
- * true}
111
+ * @param estimates This attribute controls whether index selectivity estimates are maintained for the index.
112
+ * Default: {@code
113
+ * true}
111
114
* @since ArangoDB 3.8
112
115
*/
113
116
public PersistentIndexOptions estimates (final Boolean estimates ) {
@@ -121,6 +124,7 @@ public Boolean getEstimates() {
121
124
122
125
/**
123
126
* @param cacheEnabled enables in-memory caching of index entries
127
+ * @return options
124
128
* @since ArangoDB 3.10
125
129
*/
126
130
public PersistentIndexOptions cacheEnabled (final Boolean cacheEnabled ) {
@@ -132,4 +136,23 @@ public Boolean getCacheEnabled() {
132
136
return cacheEnabled ;
133
137
}
134
138
139
+ public Collection <String > getStoredValues () {
140
+ return storedValues ;
141
+ }
142
+
143
+ /**
144
+ * @param storedValues (optional) array of paths to additional attributes to store in the index. These additional
145
+ * attributes cannot be used for index lookups or for sorting, but they can be used for
146
+ * projections. This allows an index to fully cover more queries and avoid extra document
147
+ * lookups. The maximum number of attributes in `storedValues` is 32.
148
+ * @return options
149
+ */
150
+ public PersistentIndexOptions storedValues (final String ... storedValues ) {
151
+ if (this .storedValues == null ) {
152
+ this .storedValues = new HashSet <>();
153
+ }
154
+ Collections .addAll (this .storedValues , storedValues );
155
+ return this ;
156
+ }
157
+
135
158
}
0 commit comments