From 09ffa4fa3037191a6deae7c7c1cf1b4c3c447f6d Mon Sep 17 00:00:00 2001 From: tjoubert Date: Wed, 14 Sep 2022 10:40:00 +0400 Subject: [PATCH 1/3] Analyzer and view changes --- .../AnalyzerApi/Models/Analyzer.cs | 2 ++ .../AnalyzerApi/Models/AnalyzerProperties.cs | 18 ++++++++++++++++++ .../ViewApi/Models/ViewDetails.cs | 8 +++++++- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/arangodb-net-standard/AnalyzerApi/Models/Analyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/Analyzer.cs index c0916b56..b737e840 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/Analyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/Analyzer.cs @@ -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. /// public List Features { get; set; } } diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties.cs index e2f22ac9..f5e1bfed 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties.cs @@ -55,5 +55,23 @@ public class AnalyzerProperties /// https://www.arangodb.com/docs/stable/analyzers.html#stemming /// public bool Stemming { get; set; } + + /// + /// 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. + /// + public Analyzer Analyzer { get; set; } + + /// + /// Introduced in 3.10. for minHash analyzers. + /// Specifies the size of min hash signature. + /// Must be greater or equal to 1. Signature + /// size defines probabilistic error. + /// + public int? NumHashes { get; set; } } } \ No newline at end of file diff --git a/arangodb-net-standard/ViewApi/Models/ViewDetails.cs b/arangodb-net-standard/ViewApi/Models/ViewDetails.cs index 915d3d2f..3fbea000 100644 --- a/arangodb-net-standard/ViewApi/Models/ViewDetails.cs +++ b/arangodb-net-standard/ViewApi/Models/ViewDetails.cs @@ -12,6 +12,11 @@ public class ViewDetails /// public const string ArangoSearchViewType = "arangosearch"; + /// + /// Possible value for + /// + public const string SearchAliasViewType = "search-alias"; + /// /// Possible value for /// @@ -29,7 +34,8 @@ public class ViewDetails /// /// The type of the View. - /// Must be set to + /// Can be set to + /// or /// when creating a view. /// This option is immutable. /// From 05bee2c0c8955525e8301dbdb474bc4e60612e14 Mon Sep 17 00:00:00 2001 From: tjoubert Date: Fri, 30 Sep 2022 10:03:26 +0400 Subject: [PATCH 2/3] Changes to views and analyzers for 3.10 --- .../AnalyzerApi/Models/AnalyzerProperties.cs | 42 ++++++++++++++++-- .../ViewApi/Models/SearchAliasIndex.cs | 43 +++++++++++++++++++ .../ViewApi/Models/ViewDetails.cs | 12 ++++-- 3 files changed, 90 insertions(+), 7 deletions(-) create mode 100644 arangodb-net-standard/ViewApi/Models/SearchAliasIndex.cs diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties.cs index f5e1bfed..b2675ea2 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties.cs @@ -13,7 +13,7 @@ public class AnalyzerProperties /// When false, accented characters are converted to /// their base characters. /// - public bool Accent { get; set; } + public bool? Accent { get; set; } /// /// A locale in the format language[_COUNTRY][.encoding][@variant] @@ -54,7 +54,7 @@ public class AnalyzerProperties /// which supports the languages listed at: /// https://www.arangodb.com/docs/stable/analyzers.html#stemming /// - public bool Stemming { get; set; } + public bool? Stemming { get; set; } /// /// Introduced in 3.10. for minHash analyzers. @@ -69,9 +69,43 @@ public class AnalyzerProperties /// /// Introduced in 3.10. for minHash analyzers. /// Specifies the size of min hash signature. - /// Must be greater or equal to 1. Signature - /// size defines probabilistic error. + /// 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. /// public int? NumHashes { get; set; } + + /// + /// 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. + /// + public string Model_Location { get; set; } + + /// + /// Introduced in 3.10. The number of class + /// labels that will be produced per input + /// (default: 1). + /// Optional for classification and + /// nearest_neighbors analyzers. + /// + public int? Top_K { get; set; } + + /// + /// 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. + /// + public decimal? Threshold { get; set; } } } \ No newline at end of file diff --git a/arangodb-net-standard/ViewApi/Models/SearchAliasIndex.cs b/arangodb-net-standard/ViewApi/Models/SearchAliasIndex.cs new file mode 100644 index 00000000..b4fda082 --- /dev/null +++ b/arangodb-net-standard/ViewApi/Models/SearchAliasIndex.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ArangoDBNetStandard.ViewApi.Models +{ + public class SearchAliasIndex + { + /// + /// Possible value for + /// + public const string SearchAliasIndexAddOperation = "add"; + + /// + /// Possible value for + /// + public const string SearchAliasIndexDelOperation = "del"; + + /// + /// Possible value for + /// + public const string SearchAliasIndexNoOperation = ""; + + /// + /// Name of the collection + /// + public string Collection { get; set; } + + /// + /// Name of the index + /// + public string Index { get; set; } + + /// + /// Optional. Type of operation. + /// Possible values: + /// , + /// , or + /// + /// + public string Operation { get; set; } + } +} \ No newline at end of file diff --git a/arangodb-net-standard/ViewApi/Models/ViewDetails.cs b/arangodb-net-standard/ViewApi/Models/ViewDetails.cs index 3fbea000..55300709 100644 --- a/arangodb-net-standard/ViewApi/Models/ViewDetails.cs +++ b/arangodb-net-standard/ViewApi/Models/ViewDetails.cs @@ -48,7 +48,7 @@ public class ViewDetails /// (default: 2, to disable use: 0). /// Read more about this in the documentation. /// - public int CleanupIntervalStep { get; set; } + public int? CleanupIntervalStep { get; set; } /// /// The number of milliseconds to wait @@ -57,7 +57,7 @@ public class ViewDetails /// to queries (default: 1000, to disable use: 0) /// Read more about this in the documentation. /// - public int CommitIntervalMsec { get; set; } + public int? CommitIntervalMsec { get; set; } /// /// The number of milliseconds to wait @@ -67,7 +67,7 @@ public class ViewDetails /// (default: 10000, to disable use: 0). /// Read more about this in the documentation. /// - public int ConsolidationIntervalMsec { get; set; } + public int? ConsolidationIntervalMsec { get; set; } /// /// The consolidation policy to apply @@ -132,5 +132,11 @@ public class ViewDetails /// and the link properties as attribute values. /// public IDictionary Links { get; set; } + + /// + /// Introduced in 3.10. List of indexes for + /// search-alias views. + /// + public List Indexes { get; set; } } } \ No newline at end of file From 799f99fbecff4f2e18e5642799feda05f16a05a3 Mon Sep 17 00:00:00 2001 From: tjoubert Date: Tue, 11 Oct 2022 08:47:04 +0400 Subject: [PATCH 3/3] Review changes --- .../AnalyzerApi/Models/AnalyzerProperties.cs | 2 +- .../ViewApi/Models/SearchAliasIndex.cs | 22 +++------------ .../Models/SearchAliasIndexOperation.cs | 24 ++++++++++++++++ .../ViewApi/Models/SortCompressionTypes.cs | 23 +++++++++++++++ .../ViewApi/Models/ViewDetails.cs | 28 +++---------------- .../ViewApi/Models/ViewTypes.cs | 23 +++++++++++++++ 6 files changed, 79 insertions(+), 43 deletions(-) create mode 100644 arangodb-net-standard/ViewApi/Models/SearchAliasIndexOperation.cs create mode 100644 arangodb-net-standard/ViewApi/Models/SortCompressionTypes.cs create mode 100644 arangodb-net-standard/ViewApi/Models/ViewTypes.cs diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties.cs index b2675ea2..147b91c0 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties.cs @@ -57,7 +57,7 @@ public class AnalyzerProperties public bool? Stemming { get; set; } /// - /// Introduced in 3.10. for minHash analyzers. + /// 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. diff --git a/arangodb-net-standard/ViewApi/Models/SearchAliasIndex.cs b/arangodb-net-standard/ViewApi/Models/SearchAliasIndex.cs index b4fda082..b8aae990 100644 --- a/arangodb-net-standard/ViewApi/Models/SearchAliasIndex.cs +++ b/arangodb-net-standard/ViewApi/Models/SearchAliasIndex.cs @@ -6,21 +6,6 @@ namespace ArangoDBNetStandard.ViewApi.Models { public class SearchAliasIndex { - /// - /// Possible value for - /// - public const string SearchAliasIndexAddOperation = "add"; - - /// - /// Possible value for - /// - public const string SearchAliasIndexDelOperation = "del"; - - /// - /// Possible value for - /// - public const string SearchAliasIndexNoOperation = ""; - /// /// Name of the collection /// @@ -34,9 +19,10 @@ public class SearchAliasIndex /// /// Optional. Type of operation. /// Possible values: - /// , - /// , or - /// + /// , or + /// + /// Only relevant when updating the + /// properties of a View definition. /// public string Operation { get; set; } } diff --git a/arangodb-net-standard/ViewApi/Models/SearchAliasIndexOperation.cs b/arangodb-net-standard/ViewApi/Models/SearchAliasIndexOperation.cs new file mode 100644 index 00000000..35d98176 --- /dev/null +++ b/arangodb-net-standard/ViewApi/Models/SearchAliasIndexOperation.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ArangoDBNetStandard.ViewApi.Models +{ + /// + /// Possible operations for search alias indexes. + /// + public static class SearchAliasIndexOperation + { + /// + /// Add the index to the stored indexes + /// property of the View. + /// + public const string Add = "add"; + + /// + /// Remove the index from the stored indexes + /// property of the View. + /// + public const string Del = "del"; + } +} \ No newline at end of file diff --git a/arangodb-net-standard/ViewApi/Models/SortCompressionTypes.cs b/arangodb-net-standard/ViewApi/Models/SortCompressionTypes.cs new file mode 100644 index 00000000..1ce6c54d --- /dev/null +++ b/arangodb-net-standard/ViewApi/Models/SortCompressionTypes.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ArangoDBNetStandard.ViewApi.Models +{ + /// + /// Defines values for ArangoDB sort compression types. + /// Possible value for + /// + public static class SortCompressionTypes + { + /// + /// Use LZ4 fast compression. + /// + public const string LZ4 = "lz4"; + + /// + /// Disable compression to trade space for speed. + /// + public const string None = "none"; + } +} \ No newline at end of file diff --git a/arangodb-net-standard/ViewApi/Models/ViewDetails.cs b/arangodb-net-standard/ViewApi/Models/ViewDetails.cs index 55300709..00bb9174 100644 --- a/arangodb-net-standard/ViewApi/Models/ViewDetails.cs +++ b/arangodb-net-standard/ViewApi/Models/ViewDetails.cs @@ -7,26 +7,6 @@ namespace ArangoDBNetStandard.ViewApi.Models /// public class ViewDetails { - /// - /// Possible value for - /// - public const string ArangoSearchViewType = "arangosearch"; - - /// - /// Possible value for - /// - public const string SearchAliasViewType = "search-alias"; - - /// - /// Possible value for - /// - public const string LZ4SortCompression = "lz4"; - - /// - /// Possible value for - /// - public const string NoSortCompression = "none"; - /// /// The name of the View. /// @@ -34,8 +14,8 @@ public class ViewDetails /// /// The type of the View. - /// Can be set to - /// or + /// Can be set to + /// or /// when creating a view. /// This option is immutable. /// @@ -88,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) (default): use LZ4 fast compression. - /// 2) : disable compression to trade space for speed. + /// 1) (default): use LZ4 fast compression. + /// 2) : disable compression to trade space for speed. /// Read more about this in the documentation. /// public string PrimarySortCompression { get; set; } diff --git a/arangodb-net-standard/ViewApi/Models/ViewTypes.cs b/arangodb-net-standard/ViewApi/Models/ViewTypes.cs new file mode 100644 index 00000000..cee4be26 --- /dev/null +++ b/arangodb-net-standard/ViewApi/Models/ViewTypes.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ArangoDBNetStandard.ViewApi.Models +{ + /// + /// Defines values for ArangoDB view types. + /// Possible value for + /// + public static class ViewTypes + { + /// + /// See https://www.arangodb.com/docs/stable/arangosearch-views.html + /// + public const string ArangoSearch = "arangosearch"; + + /// + /// See https://www.arangodb.com/docs/stable/arangosearch-views-search-alias.html + /// + public const string SearchAlias = "search-alias"; + } +} \ No newline at end of file