Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 64 additions & 32 deletions docs/Drivers/Java/Reference/View/ArangoSearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,31 @@ Creates a ArangoSearch view with the given _options_, then returns view informat

- **options**: `ArangoSearchCreateOptions`

- **locale**: `String`

The default locale used for queries on analyzed string values (default: C).

- **commitIntervalMsec**: `Long`
- **consolidationIntervalMsec**: `Long`

Wait at least this many milliseconds between committing index data changes and making them visible to queries (default: 60000, to disable use: 0). For the case where there are a lot of inserts/updates, a lower value, until commit, will cause the index not to account for them and memory usage would continue to grow. For the case where there are a few inserts/updates, a higher value will impact performance and waste disk space for each commit call without any added benefits.

- **cleanupIntervalStep**: `Long`

Wait at least this many commits between removing unused files in data directory (default: 10, to disable use: 0). For the case where the consolidation policies merge segments often (i.e. a lot of commit+consolidate), a lower value will cause a lot of disk space to be wasted. For the case where the consolidation policies rarely merge segments (i.e. few inserts/deletes), a higher value will impact performance without any added benefits.

- **threshold**: `ConsolidateThreshold[]`
- **consolidationPolicy**:

- **type**: `ConsolidateType`

The type of the consolidation policy.

- **threshold**: `Double`

Select a given segment for "consolidation" if and only if the formula based on type (as defined above) evaluates to true, valid value range [0.0, 1.0] (default: 0.85)

- **segmentThreshold**: `Long`

Apply the "consolidation" operation if and only if (default: 300): {segmentThreshold} < number_of_segments

A list of consolidate thresholds
- **link**: `CollectionLink[]`

A list of linked collections

**Examples**

Expand All @@ -58,21 +68,31 @@ Alternative for [ArangoDatabase.createArangoSearch](#arangodatabasecreatearangos

- **options**: `ArangoSearchCreateOptions`

- **locale**: `String`

The default locale used for queries on analyzed string values (default: C).

- **commitIntervalMsec**: `Long`
- **consolidationIntervalMsec**: `Long`

Wait at least this many milliseconds between committing index data changes and making them visible to queries (default: 60000, to disable use: 0). For the case where there are a lot of inserts/updates, a lower value, until commit, will cause the index not to account for them and memory usage would continue to grow. For the case where there are a few inserts/updates, a higher value will impact performance and waste disk space for each commit call without any added benefits.

- **cleanupIntervalStep**: `Long`

Wait at least this many commits between removing unused files in data directory (default: 10, to disable use: 0). For the case where the consolidation policies merge segments often (i.e. a lot of commit+consolidate), a lower value will cause a lot of disk space to be wasted. For the case where the consolidation policies rarely merge segments (i.e. few inserts/deletes), a higher value will impact performance without any added benefits.

- **threshold**: `ConsolidateThreshold[]`
- **consolidationPolicy**:

- **type**: `ConsolidateType`

The type of the consolidation policy.

- **threshold**: `Double`

Select a given segment for "consolidation" if and only if the formula based on type (as defined above) evaluates to true, valid value range [0.0, 1.0] (default: 0.85)

- **segmentThreshold**: `Long`

A list of consolidate thresholds
Apply the "consolidation" operation if and only if (default: 300): {segmentThreshold} < number_of_segments

- **link**: `CollectionLink[]`

A list of linked collections

**Examples**

Expand Down Expand Up @@ -115,25 +135,31 @@ Partially changes properties of the view.

- **options**: `ArangoSearchPropertiesOptions`

- **locale**: `String`

The default locale used for queries on analyzed string values (default: C).

- **commitIntervalMsec**: `Long`
- **consolidationIntervalMsec**: `Long`

Wait at least this many milliseconds between committing index data changes and making them visible to queries (default: 60000, to disable use: 0). For the case where there are a lot of inserts/updates, a lower value, until commit, will cause the index not to account for them and memory usage would continue to grow. For the case where there are a few inserts/updates, a higher value will impact performance and waste disk space for each commit call without any added benefits.

- **cleanupIntervalStep**: `Long`

Wait at least this many commits between removing unused files in data directory (default: 10, to disable use: 0). For the case where the consolidation policies merge segments often (i.e. a lot of commit+consolidate), a lower value will cause a lot of disk space to be wasted. For the case where the consolidation policies rarely merge segments (i.e. few inserts/deletes), a higher value will impact performance without any added benefits.

- **threshold**: `ConsolidateThreshold[]`
- **consolidationPolicy**:

- **type**: `ConsolidateType`

The type of the consolidation policy.

- **threshold**: `Double`

Select a given segment for "consolidation" if and only if the formula based on type (as defined above) evaluates to true, valid value range [0.0, 1.0] (default: 0.85)

A list of consolidate thresholds
- **segmentThreshold**: `Long`

- **link**: `CollectionLink[]`
Apply the "consolidation" operation if and only if (default: 300): {segmentThreshold} < number_of_segments

A list of linked collections
- **link**: `CollectionLink[]`

A list of linked collections

**Examples**

Expand All @@ -157,25 +183,31 @@ Changes properties of the view.

- **options**: `ArangoSearchPropertiesOptions`

- **locale**: `String`

The default locale used for queries on analyzed string values (default: C).

- **commitIntervalMsec**: `Long`
- **consolidationIntervalMsec**: `Long`

Wait at least this many milliseconds between committing index data changes and making them visible to queries (default: 60000, to disable use: 0). For the case where there are a lot of inserts/updates, a lower value, until commit, will cause the index not to account for them and memory usage would continue to grow. For the case where there are a few inserts/updates, a higher value will impact performance and waste disk space for each commit call without any added benefits.

- **cleanupIntervalStep**: `Long`

Wait at least this many commits between removing unused files in data directory (default: 10, to disable use: 0). For the case where the consolidation policies merge segments often (i.e. a lot of commit+consolidate), a lower value will cause a lot of disk space to be wasted. For the case where the consolidation policies rarely merge segments (i.e. few inserts/deletes), a higher value will impact performance without any added benefits.

- **threshold**: `ConsolidateThreshold[]`
- **consolidationPolicy**:

- **type**: `ConsolidateType`

The type of the consolidation policy.

- **threshold**: `Double`

Select a given segment for "consolidation" if and only if the formula based on type (as defined above) evaluates to true, valid value range [0.0, 1.0] (default: 0.85)

- **segmentThreshold**: `Long`

A list of consolidate thresholds
Apply the "consolidation" operation if and only if (default: 300): {segmentThreshold} < number_of_segments

- **link**: `CollectionLink[]`
- **link**: `CollectionLink[]`

A list of linked collections
A list of linked collections

**Examples**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,22 @@
*/
public class ArangoSearchProperties {

private String locale;
private Long commitIntervalMsec;
private Long consolidationIntervalMsec;
private Long cleanupIntervalStep;
private final Collection<ConsolidateThreshold> thresholds;
private ConsolidationPolicy consolidationPolicy;
private final Collection<CollectionLink> links;

public ArangoSearchProperties() {
super();
thresholds = new ArrayList<ConsolidateThreshold>();
links = new ArrayList<CollectionLink>();
}

public String getLocale() {
return locale;
public Long getConsolidationIntervalMsec() {
return consolidationIntervalMsec;
}

public void setLocale(final String locale) {
this.locale = locale;
}

public Long getCommitIntervalMsec() {
return commitIntervalMsec;
}

public void setCommitIntervalMsec(final Long commitIntervalMsec) {
this.commitIntervalMsec = commitIntervalMsec;
public void setConsolidationIntervalMsec(final Long consolidationIntervalMsec) {
this.consolidationIntervalMsec = consolidationIntervalMsec;
}

public Long getCleanupIntervalStep() {
Expand All @@ -66,12 +56,12 @@ public void setCleanupIntervalStep(final Long cleanupIntervalStep) {
this.cleanupIntervalStep = cleanupIntervalStep;
}

public Collection<ConsolidateThreshold> getThresholds() {
return thresholds;
public ConsolidationPolicy getConsolidationPolicy() {
return consolidationPolicy;
}

public void addThreshold(final ConsolidateThreshold... thresholds) {
this.thresholds.addAll(Arrays.asList(thresholds));
public void setConsolidationPolicy(final ConsolidationPolicy consolidationPolicy) {
this.consolidationPolicy = consolidationPolicy;
}

public Collection<CollectionLink> getLinks() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,15 @@ public ArangoSearchPropertiesEntity(final String id, final String name, final Vi
this.properties = properties;
}

/**
* @return The default locale used for queries on analyzed string values (default: C).
*/
public String getLocale() {
return properties.getLocale();
}

/**
* @return Wait at least this many milliseconds between committing index data changes and making them visible to
* queries (default: 60000, to disable use: 0). For the case where there are a lot of inserts/updates, a
* lower value, until commit, will cause the index not to account for them and memory usage would continue
* to grow. For the case where there are a few inserts/updates, a higher value will impact performance and
* waste disk space for each commit call without any added benefits.
*/
public Long getCommitIntervalMsec() {
return properties.getCommitIntervalMsec();
public Long getConsolidationIntervalMsec() {
return properties.getConsolidationIntervalMsec();
}

/**
Expand All @@ -68,11 +61,8 @@ public Long getCleanupIntervalStep() {
return properties.getCleanupIntervalStep();
}

/**
* @return A list of consolidate thresholds
*/
public Collection<ConsolidateThreshold> getThresholds() {
return properties.getThresholds();
public ConsolidationPolicy getConsolidationPolicy() {
return properties.getConsolidationPolicy();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,39 @@
* @author Mark Vollmary
*
*/
public class ConsolidateThreshold {
public class ConsolidationPolicy {

private final ConsolidateType type;
private Double threshold;
private Long segmentThreshold;

private ConsolidateThreshold(final ConsolidateType type) {
private ConsolidationPolicy(final ConsolidateType type) {
super();
this.type = type;
}

public static ConsolidateThreshold of(final ConsolidateType type) {
return new ConsolidateThreshold(type);
public static ConsolidationPolicy of(final ConsolidateType type) {
return new ConsolidationPolicy(type);
}

public ConsolidateThreshold threshold(final Double threshold) {
/**
* @param threshold
* Select a given segment for "consolidation" if and only if the formula based on type (as defined above)
* evaluates to true, valid value range [0.0, 1.0] (default: 0.85)
* @return policy
*/
public ConsolidationPolicy threshold(final Double threshold) {
this.threshold = threshold;
return this;
}

public ConsolidateThreshold segmentThreshold(final Long segmentThreshold) {
/**
* @param segmentThreshold
* Apply the "consolidation" operation if and only if (default: 300): {segmentThreshold} <
* number_of_segments
* @return policy
*/
public ConsolidationPolicy segmentThreshold(final Long segmentThreshold) {
this.segmentThreshold = segmentThreshold;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
import com.arangodb.entity.arangosearch.ArangoSearchProperties;
import com.arangodb.entity.arangosearch.ArangoSearchPropertiesEntity;
import com.arangodb.entity.arangosearch.CollectionLink;
import com.arangodb.entity.arangosearch.ConsolidateThreshold;
import com.arangodb.entity.arangosearch.ConsolidateType;
import com.arangodb.entity.arangosearch.ConsolidationPolicy;
import com.arangodb.entity.arangosearch.FieldLink;
import com.arangodb.entity.arangosearch.StoreValuesType;
import com.arangodb.velocypack.VPackDeserializationContext;
Expand Down Expand Up @@ -217,38 +217,18 @@ public ArangoSearchProperties deserialize(
final VPackSlice vpack,
final VPackDeserializationContext context) throws VPackException {
final ArangoSearchProperties properties = new ArangoSearchProperties();
final VPackSlice locale = vpack.get("locale");
if (locale.isString()) {
properties.setLocale(locale.getAsString());
final VPackSlice consolidationIntervalMsec = vpack.get("consolidationIntervalMsec");
if (consolidationIntervalMsec.isInteger()) {
properties.setConsolidationIntervalMsec(consolidationIntervalMsec.getAsLong());
}
final VPackSlice commit = vpack.get("commit");
if (commit.isObject()) {
final VPackSlice commitIntervalMsec = commit.get("commitIntervalMsec");
if (commitIntervalMsec.isInteger()) {
properties.setCommitIntervalMsec(commitIntervalMsec.getAsLong());
}
final VPackSlice cleanupIntervalStep = commit.get("cleanupIntervalStep");
if (cleanupIntervalStep.isInteger()) {
properties.setCleanupIntervalStep(cleanupIntervalStep.getAsLong());
}
final VPackSlice consolidate = commit.get("consolidate");
if (consolidate.isObject()) {
for (final ConsolidateType type : ConsolidateType.values()) {
final VPackSlice consolidateThreshold = consolidate.get(type.name().toLowerCase());
if (consolidateThreshold.isObject()) {
final ConsolidateThreshold t = ConsolidateThreshold.of(type);
final VPackSlice threshold = consolidateThreshold.get("threshold");
if (threshold.isNumber()) {
t.threshold(threshold.getAsDouble());
}
final VPackSlice segmentThreshold = consolidateThreshold.get("segmentThreshold");
if (segmentThreshold.isInteger()) {
t.segmentThreshold(segmentThreshold.getAsLong());
}
properties.addThreshold(t);
}
}
}
final VPackSlice cleanupIntervalStep = vpack.get("cleanupIntervalStep");
if (cleanupIntervalStep.isInteger()) {
properties.setCleanupIntervalStep(cleanupIntervalStep.getAsLong());
}
final VPackSlice consolidationPolicy = vpack.get("consolidationPolicy");
if (consolidationPolicy.isObject()) {
properties.setConsolidationPolicy(
(ConsolidationPolicy) context.deserialize(consolidationPolicy, ConsolidationPolicy.class));
}

final VPackSlice links = vpack.get("links");
Expand Down Expand Up @@ -337,4 +317,28 @@ public ArangoSearchPropertiesEntity deserialize(
}
};

public static final VPackDeserializer<ConsolidationPolicy> CONSOLIDATE = new VPackDeserializer<ConsolidationPolicy>() {
@Override
public ConsolidationPolicy deserialize(
final VPackSlice parent,
final VPackSlice vpack,
final VPackDeserializationContext context) throws VPackException {
final VPackSlice type = vpack.get("type");
if (type.isString()) {
final ConsolidationPolicy consolidate = ConsolidationPolicy
.of(ConsolidateType.valueOf(type.getAsString().toUpperCase()));
final VPackSlice threshold = vpack.get("threshold");
if (threshold.isNumber()) {
consolidate.threshold(threshold.getAsDouble());
}
final VPackSlice segmentThreshold = vpack.get("segmentThreshold");
if (segmentThreshold.isInteger()) {
consolidate.segmentThreshold(segmentThreshold.getAsLong());
}
return consolidate;
}
return null;
}
};

}
Loading