Skip to content

Commit 64d07c1

Browse files
committed
[DE-379] inverted indexes documentation
1 parent f7f5089 commit 64d07c1

File tree

5 files changed

+207
-17
lines changed

5 files changed

+207
-17
lines changed

src/main/java/com/arangodb/entity/InvertedIndexEntity.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
import java.util.Set;
2929

3030
/**
31-
* TODO: add documentation
32-
*
3331
* @author Michele Rastelli
3432
* @see <a href="https://www.arangodb.com/docs/stable/http/indexes-inverted.html">API Documentation</a>
3533
* @since ArangoDB 3.10

src/main/java/com/arangodb/entity/InvertedIndexField.java

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import java.util.*;
66

77
/**
8-
* TODO: add documentation
9-
*
108
* @author Michele Rastelli
119
* @see <a href="https://www.arangodb.com/docs/stable/http/indexes-inverted.html">API Documentation</a>
1210
* @since ArangoDB 3.10
@@ -24,6 +22,10 @@ public String getName() {
2422
return name;
2523
}
2624

25+
/**
26+
* @param name An attribute path. The . character denotes sub-attributes.
27+
* @return this
28+
*/
2729
public InvertedIndexField name(String name) {
2830
this.name = name;
2931
return this;
@@ -33,6 +35,11 @@ public String getAnalyzer() {
3335
return analyzer;
3436
}
3537

38+
/**
39+
* @param analyzer The name of an Analyzer to use for this field. Default: the value defined by the top-level
40+
* analyzer option, or if not set, the default identity Analyzer.
41+
* @return this
42+
*/
3643
public InvertedIndexField analyzer(String analyzer) {
3744
this.analyzer = analyzer;
3845
return this;
@@ -42,6 +49,15 @@ public Boolean getIncludeAllFields() {
4249
return includeAllFields;
4350
}
4451

52+
/**
53+
* @param includeAllFields This option only applies if you use the inverted index in a search-alias Views. If set to
54+
* true, then all sub-attributes of this field are indexed, excluding any sub-attributes
55+
* that are configured separately by other elements in the fields array (and their
56+
* sub-attributes). The analyzer and features properties apply to the sub-attributes. If set
57+
* to false, then sub-attributes are ignored. The default value is defined by the top-level
58+
* includeAllFields option, or false if not set.
59+
* @return this
60+
*/
4561
public InvertedIndexField includeAllFields(Boolean includeAllFields) {
4662
this.includeAllFields = includeAllFields;
4763
return this;
@@ -51,6 +67,18 @@ public Boolean getSearchField() {
5167
return searchField;
5268
}
5369

70+
/**
71+
* @param searchField This option only applies if you use the inverted index in a search-alias Views. You can set
72+
* the option to true to get the same behavior as with arangosearch Views regarding the indexing
73+
* of array values for this field. If enabled, both, array and primitive values (strings,
74+
* numbers, etc.) are accepted. Every element of an array is indexed according to the
75+
* trackListPositions option. If set to false, it depends on the attribute path. If it explicitly
76+
* expand an array ([*]), then the elements are indexed separately. Otherwise, the array is
77+
* indexed as a whole, but only geopoint and aql Analyzers accept array inputs. You cannot use an
78+
* array expansion if searchField is enabled. Default: the value defined by the top-level
79+
* searchField option, or false if not set.
80+
* @return this
81+
*/
5482
public InvertedIndexField searchField(Boolean searchField) {
5583
this.searchField = searchField;
5684
return this;
@@ -60,6 +88,16 @@ public Boolean getTrackListPositions() {
6088
return trackListPositions;
6189
}
6290

91+
/**
92+
* @param trackListPositions This option only applies if you use the inverted index in a search-alias Views. If set
93+
* to true, then track the value position in arrays for array values. For example, when
94+
* querying a document like { attr: [ "valueX", "valueY", "valueZ" ] }, you need to
95+
* specify the array element, e.g. doc.attr[1] == "valueY". If set to false, all values in
96+
* an array are treated as equal alternatives. You don’t specify an array element in
97+
* queries, e.g. doc.attr == "valueY", and all elements are searched for a match. Default:
98+
* the value defined by the top-level trackListPositions option, or false if not set.
99+
* @return this
100+
*/
63101
public InvertedIndexField trackListPositions(Boolean trackListPositions) {
64102
this.trackListPositions = trackListPositions;
65103
return this;
@@ -69,6 +107,11 @@ public Set<AnalyzerFeature> getFeatures() {
69107
return features;
70108
}
71109

110+
/**
111+
* @param features A list of Analyzer features to use for this field. They define what features are enabled for the
112+
* analyzer.
113+
* @return this
114+
*/
72115
public InvertedIndexField features(AnalyzerFeature... features) {
73116
Collections.addAll(this.features, features);
74117
return this;
@@ -78,8 +121,15 @@ public Collection<InvertedIndexField> getNested() {
78121
return nested;
79122
}
80123

124+
/**
125+
* @param nested Index the specified sub-objects that are stored in an array. Other than with the fields property,
126+
* the values get indexed in a way that lets you query for co-occurring values. For example, you can
127+
* search the sub-objects and all the conditions need to be met by a single sub-object instead of
128+
* across all of them. This property is available in the Enterprise Edition only.
129+
* @return this
130+
*/
81131
public InvertedIndexField nested(InvertedIndexField... nested) {
82-
if(this.nested == null) this.nested = new ArrayList<>();
132+
if (this.nested == null) this.nested = new ArrayList<>();
83133
Collections.addAll(this.nested, nested);
84134
return this;
85135
}

src/main/java/com/arangodb/entity/InvertedIndexPrimarySort.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import java.util.Objects;
99

1010
/**
11-
* TODO: add documentation
12-
*
1311
* @author Michele Rastelli
1412
* @see <a href="https://www.arangodb.com/docs/stable/http/indexes-inverted.html">API Documentation</a>
1513
* @since ArangoDB 3.10
@@ -22,6 +20,10 @@ public List<Field> getFields() {
2220
return fields;
2321
}
2422

23+
/**
24+
* @param fields An array of the fields to sort the index by and the direction to sort each field in.
25+
* @return this
26+
*/
2527
public InvertedIndexPrimarySort fields(Field... fields) {
2628
Collections.addAll(this.fields, fields);
2729
return this;
@@ -31,6 +33,10 @@ public ArangoSearchCompression getCompression() {
3133
return compression;
3234
}
3335

36+
/**
37+
* @param compression Defines how to compress the primary sort data.
38+
* @return this
39+
*/
3440
public InvertedIndexPrimarySort compression(ArangoSearchCompression compression) {
3541
this.compression = compression;
3642
return this;
@@ -53,6 +59,10 @@ public static class Field {
5359
private final String field;
5460
private final Direction direction;
5561

62+
/**
63+
* @param field An attribute path. The . character denotes sub-attributes.
64+
* @param direction The sorting direction.
65+
*/
5666
public Field(String field, Direction direction) {
5767
this.field = field;
5868
this.direction = direction;

src/main/java/com/arangodb/entity/arangosearch/StoredValue.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ public class StoredValue {
3434
private final List<String> fields;
3535
private final ArangoSearchCompression compression;
3636

37+
/**
38+
* @param fields A list of attribute paths. The . character denotes sub-attributes.
39+
* @param compression Defines how to compress the attribute values.
40+
*/
3741
public StoredValue(List<String> fields, ArangoSearchCompression compression) {
3842
this.fields = fields;
3943
this.compression = compression;
@@ -43,18 +47,10 @@ public StoredValue(List<String> fields) {
4347
this(fields, null);
4448
}
4549

46-
/**
47-
* @return an array of strings with one or more document attribute paths. The specified attributes are placed into a
48-
* single column of the index. A column with all fields that are involved in common search queries is ideal for
49-
* performance. The column should not include too many unneeded fields however.
50-
*/
5150
public List<String> getFields() {
5251
return fields;
5352
}
5453

55-
/**
56-
* @return defines the compression type used for the internal column-store
57-
*/
5854
public ArangoSearchCompression getCompression() {
5955
return compression;
6056
}

0 commit comments

Comments
 (0)