Skip to content

Commit

Permalink
Merge pull request #422 from ArangoDB-Community/feature3.10/DE-352-ar…
Browse files Browse the repository at this point in the history
…angosearch-changes

ArangoSearch changes in ArangoDB 3.10
  • Loading branch information
tjoubert authored Oct 11, 2022
2 parents 72b1d66 + 799f99f commit 3deb20e
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 23 deletions.
2 changes: 2 additions & 0 deletions arangodb-net-standard/AnalyzerApi/Models/Analyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public class Analyzer
/// position: sequentially increasing term position,
/// required for PHRASE(). If present then the
/// frequency feature is also required.
/// offset: 3.10 onwards. Enables search highlighting capabilities
/// for ArangoSearch Views.
/// </summary>
public List<string> Features { get; set; }
}
Expand Down
56 changes: 54 additions & 2 deletions arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class AnalyzerProperties
/// When false, accented characters are converted to
/// their base characters.
/// </summary>
public bool Accent { get; set; }
public bool? Accent { get; set; }

/// <summary>
/// A locale in the format language[_COUNTRY][.encoding][@variant]
Expand Down Expand Up @@ -54,6 +54,58 @@ public class AnalyzerProperties
/// which supports the languages listed at:
/// https://www.arangodb.com/docs/stable/analyzers.html#stemming
/// </summary>
public bool Stemming { get; set; }
public bool? Stemming { get; set; }

/// <summary>
/// Introduced in 3.10 for minHash analyzers.
/// An Analyzer-like definition with a type (string)
/// and a properties attribute (object)
/// This is the inner analyzer to use for incoming data.
/// In case if omitted field or empty object falls back
/// to identity analyzer.
/// </summary>
public Analyzer Analyzer { get; set; }

/// <summary>
/// Introduced in 3.10. for minHash analyzers.
/// Specifies the size of min hash signature.
/// Must be greater or equal to 1.
/// The signature size defines the probalistic
/// error (err = rsqrt(numHashes)). For an error
/// amount that does not exceed 5% (0.05), use a
/// size of 1 / (0.05 * 0.05) = 400.
/// </summary>
public int? NumHashes { get; set; }

/// <summary>
/// Introduced in 3.10. The on-disk path to
/// the trained fastText supervised model.
/// Note: if you are running this in an
/// ArangoDB cluster, this model must
/// exist on every machine in the cluster.
/// Required for classification and
/// nearest_neighbors analyzers.
/// </summary>
public string Model_Location { get; set; }

/// <summary>
/// Introduced in 3.10. The number of class
/// labels that will be produced per input
/// (default: 1).
/// Optional for classification and
/// nearest_neighbors analyzers.
/// </summary>
public int? Top_K { get; set; }

/// <summary>
/// Introduced in 3.10. The probability
/// threshold for which a label will be
/// assigned to an input. A fastText model
/// produces a probability per class label,
/// and this is what will be filtered
/// (default: 0.99).
/// Optional for Classification analyzers.
/// </summary>
public decimal? Threshold { get; set; }
}
}
29 changes: 29 additions & 0 deletions arangodb-net-standard/ViewApi/Models/SearchAliasIndex.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace ArangoDBNetStandard.ViewApi.Models
{
public class SearchAliasIndex
{
/// <summary>
/// Name of the collection
/// </summary>
public string Collection { get; set; }

/// <summary>
/// Name of the index
/// </summary>
public string Index { get; set; }

/// <summary>
/// Optional. Type of operation.
/// Possible values:
/// <see cref="SearchAliasIndexOperation.Add"/>, or
/// <see cref="SearchAliasIndexOperation.Del"/>
/// Only relevant when updating the
/// properties of a View definition.
/// </summary>
public string Operation { get; set; }
}
}
24 changes: 24 additions & 0 deletions arangodb-net-standard/ViewApi/Models/SearchAliasIndexOperation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace ArangoDBNetStandard.ViewApi.Models
{
/// <summary>
/// Possible operations for search alias indexes.
/// </summary>
public static class SearchAliasIndexOperation
{
/// <summary>
/// Add the index to the stored indexes
/// property of the View.
/// </summary>
public const string Add = "add";

/// <summary>
/// Remove the index from the stored indexes
/// property of the View.
/// </summary>
public const string Del = "del";
}
}
23 changes: 23 additions & 0 deletions arangodb-net-standard/ViewApi/Models/SortCompressionTypes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace ArangoDBNetStandard.ViewApi.Models
{
/// <summary>
/// Defines values for ArangoDB sort compression types.
/// Possible value for <see cref="ViewDetails.PrimarySortCompression"/>
/// </summary>
public static class SortCompressionTypes
{
/// <summary>
/// Use LZ4 fast compression.
/// </summary>
public const string LZ4 = "lz4";

/// <summary>
/// Disable compression to trade space for speed.
/// </summary>
public const string None = "none";
}
}
34 changes: 13 additions & 21 deletions arangodb-net-standard/ViewApi/Models/ViewDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,15 @@ namespace ArangoDBNetStandard.ViewApi.Models
/// </summary>
public class ViewDetails
{
/// <summary>
/// Possible value for <see cref="Type"/>
/// </summary>
public const string ArangoSearchViewType = "arangosearch";

/// <summary>
/// Possible value for <see cref="PrimarySortCompression"/>
/// </summary>
public const string LZ4SortCompression = "lz4";

/// <summary>
/// Possible value for <see cref="PrimarySortCompression"/>
/// </summary>
public const string NoSortCompression = "none";

/// <summary>
/// The name of the View.
/// </summary>
public string Name { get; set; }

/// <summary>
/// The type of the View.
/// Must be set to <see cref="ArangoSearchViewType"/>
/// Can be set to <see cref="ViewTypes.ArangoSearch"/>
/// or <see cref="ViewTypes.SearchAlias"/>
/// when creating a view.
/// This option is immutable.
/// </summary>
Expand All @@ -42,7 +28,7 @@ public class ViewDetails
/// (default: 2, to disable use: 0).
/// Read more about this in the documentation.
/// </summary>
public int CleanupIntervalStep { get; set; }
public int? CleanupIntervalStep { get; set; }

/// <summary>
/// The number of milliseconds to wait
Expand All @@ -51,7 +37,7 @@ public class ViewDetails
/// to queries (default: 1000, to disable use: 0)
/// Read more about this in the documentation.
/// </summary>
public int CommitIntervalMsec { get; set; }
public int? CommitIntervalMsec { get; set; }

/// <summary>
/// The number of milliseconds to wait
Expand All @@ -61,7 +47,7 @@ public class ViewDetails
/// (default: 10000, to disable use: 0).
/// Read more about this in the documentation.
/// </summary>
public int ConsolidationIntervalMsec { get; set; }
public int? ConsolidationIntervalMsec { get; set; }

/// <summary>
/// The consolidation policy to apply
Expand All @@ -82,8 +68,8 @@ public class ViewDetails
/// (introduced in v3.7.1). ArangoDB v3.5 and v3.6
/// always compress the index using LZ4.
/// This option is immutable. Possible values:
/// 1) <see cref="LZ4SortCompression"/> (default): use LZ4 fast compression.
/// 2) <see cref="NoSortCompression"/>: disable compression to trade space for speed.
/// 1) <see cref="SortCompressionTypes.LZ4"/> (default): use LZ4 fast compression.
/// 2) <see cref="SortCompressionTypes.None"/>: disable compression to trade space for speed.
/// Read more about this in the documentation.
/// </summary>
public string PrimarySortCompression { get; set; }
Expand Down Expand Up @@ -126,5 +112,11 @@ public class ViewDetails
/// and the link properties as attribute values.
/// </summary>
public IDictionary<string, LinkProperties> Links { get; set; }

/// <summary>
/// Introduced in 3.10. List of indexes for
/// search-alias views.
/// </summary>
public List<SearchAliasIndex> Indexes { get; set; }
}
}
23 changes: 23 additions & 0 deletions arangodb-net-standard/ViewApi/Models/ViewTypes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace ArangoDBNetStandard.ViewApi.Models
{
/// <summary>
/// Defines values for ArangoDB view types.
/// Possible value for <see cref="ViewDetails.Type"/>
/// </summary>
public static class ViewTypes
{
/// <summary>
/// See https://www.arangodb.com/docs/stable/arangosearch-views.html
/// </summary>
public const string ArangoSearch = "arangosearch";

/// <summary>
/// See https://www.arangodb.com/docs/stable/arangosearch-views-search-alias.html
/// </summary>
public const string SearchAlias = "search-alias";
}
}

0 comments on commit 3deb20e

Please sign in to comment.