From 119e2b132442d3b02d7171c1292b1684cc9b8f5e Mon Sep 17 00:00:00 2001 From: tjoubert Date: Wed, 21 Dec 2022 14:50:53 +0400 Subject: [PATCH 1/5] Got rid of AnalyzerProperties and implement classes for each specific analyzer type --- .../AnalyzerApi/IAnalyzerApiClient.cs | 2 +- .../AnalyzerApi/Models/Analyzer.cs | 5 +- .../AnalyzerApi/Models/AnalyzerProperties.cs | 111 ------------------ .../Models/AnalyzerProperties/AQLAnalyzer.cs | 72 ++++++++++++ .../AnalyzerPropertiesBase.cs | 11 ++ .../ClassificationAnalyzer.cs | 33 ++++++ .../AnalyzerProperties/CollationAnalyzer.cs | 18 +++ .../AnalyzerProperties/DelimiterAnalyzer.cs | 15 +++ .../AnalyzerProperties/GeoJSONAnalyzer.cs | 41 +++++++ .../GeoJSONAnalyzerOptions.cs | 25 ++++ .../AnalyzerProperties/GeoPointAnalyzer.cs | 30 +++++ .../AnalyzerProperties/IdentityAnalyzer.cs | 14 +++ .../AnalyzerProperties/MinhashAnalyzer.cs | 25 ++++ .../NearestNeighborsAnalyzer.cs | 24 ++++ .../AnalyzerProperties/NgramAnalyzer.cs | 60 ++++++++++ .../Models/AnalyzerProperties/NormAnalyzer.cs | 48 ++++++++ .../AnalyzerProperties/PipelineAnalyzer.cs | 20 ++++ .../SegmentationAnalyzer.cs | 59 ++++++++++ .../Models/AnalyzerProperties/StemAnalyzer.cs | 18 +++ .../AnalyzerProperties/StopwordsAnalyzer.cs | 25 ++++ .../Models/AnalyzerProperties/TextAnalyzer.cs | 98 ++++++++++++++++ .../TextAnalyzerEdgeNgram.cs | 27 +++++ 22 files changed, 667 insertions(+), 114 deletions(-) delete mode 100644 arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties.cs create mode 100644 arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/AQLAnalyzer.cs create mode 100644 arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/AnalyzerPropertiesBase.cs create mode 100644 arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/ClassificationAnalyzer.cs create mode 100644 arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/CollationAnalyzer.cs create mode 100644 arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/DelimiterAnalyzer.cs create mode 100644 arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzer.cs create mode 100644 arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzerOptions.cs create mode 100644 arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoPointAnalyzer.cs create mode 100644 arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/IdentityAnalyzer.cs create mode 100644 arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/MinhashAnalyzer.cs create mode 100644 arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NearestNeighborsAnalyzer.cs create mode 100644 arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NgramAnalyzer.cs create mode 100644 arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NormAnalyzer.cs create mode 100644 arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/PipelineAnalyzer.cs create mode 100644 arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/SegmentationAnalyzer.cs create mode 100644 arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/StemAnalyzer.cs create mode 100644 arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/StopwordsAnalyzer.cs create mode 100644 arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzer.cs create mode 100644 arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzerEdgeNgram.cs diff --git a/arangodb-net-standard/AnalyzerApi/IAnalyzerApiClient.cs b/arangodb-net-standard/AnalyzerApi/IAnalyzerApiClient.cs index c83bebab..da04fa80 100644 --- a/arangodb-net-standard/AnalyzerApi/IAnalyzerApiClient.cs +++ b/arangodb-net-standard/AnalyzerApi/IAnalyzerApiClient.cs @@ -7,7 +7,7 @@ namespace ArangoDBNetStandard.AnalyzerApi /// /// Defines a client to access the ArangoDB Analyzer API. /// - internal interface IAnalyzerApiClient + public interface IAnalyzerApiClient { /// /// Fetch the list of available Analyzer definitions. diff --git a/arangodb-net-standard/AnalyzerApi/Models/Analyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/Analyzer.cs index b737e840..8235fc96 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/Analyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/Analyzer.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties; +using System.Collections.Generic; namespace ArangoDBNetStandard.AnalyzerApi.Models { @@ -25,7 +26,7 @@ public class Analyzer /// Properties of the analyzer /// used to configure the specified type /// - public AnalyzerProperties Properties { get; set; } + public AnalyzerPropertiesBase Properties { get; set; } /// /// The set of features to set on diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties.cs deleted file mode 100644 index 147b91c0..00000000 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System.Collections.Generic; - -namespace ArangoDBNetStandard.AnalyzerApi.Models -{ - /// - /// Properties of an Analyzer. - /// See https://www.arangodb.com/docs/stable/analyzers.html#analyzer-properties - /// - public class AnalyzerProperties - { - /// - /// Optional. When true, accented characters are preserved. - /// When false, accented characters are converted to - /// their base characters. - /// - public bool? Accent { get; set; } - - /// - /// A locale in the format language[_COUNTRY][.encoding][@variant] - /// (square brackets denote optional parts), e.g. "de.utf-8" or - /// "en_US.utf-8". Only UTF-8 encoding is meaningful in ArangoDB. - /// The locale is forwarded to ICU without checks. An invalid - /// locale does not prevent the creation of the Analyzer. - /// - public string Locale { get; set; } - - /// - /// The case to use when normalizing the text. Possible values: - /// "lower" to convert to all lower-case characters - /// "upper" to convert to all upper-case characters - /// "none" to not change character case (default) - /// - public string Case { get; set; } - - /// - /// An Analyzer is capable of removing - /// specified tokens from the input. - /// It uses binary comparison to - /// determine if an input token should - /// be discarded. It checks for exact - /// matches. If the input contains only - /// a substring that matches one of the - /// defined stopwords, then it is not discarded. - /// Longer inputs such as prefixes of - /// stopwords are also not discarded. - /// - public List StopWords { get; set; } - - /// - /// Turn Stemming ON or OFF. - /// If true, the analyzer stems the text, - /// treated as a single token, for supported languages. - /// Stemming support is provided by Snowball, - /// which supports the languages listed at: - /// 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. - /// 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/AnalyzerApi/Models/AnalyzerProperties/AQLAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/AQLAnalyzer.cs new file mode 100644 index 00000000..f123c1f3 --- /dev/null +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/AQLAnalyzer.cs @@ -0,0 +1,72 @@ +using System; + +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +{ + /// + /// Properties for AQL analyzer + /// + public class AQLAnalyzer : AnalyzerPropertiesBase + { + /// + /// Convert emitted tokens to strings. (default) + /// + public static string ReturnTypeString = "string"; + + /// + /// Convert emitted tokens to numbers + /// + public static string ReturnTypeNumber = "number"; + + /// + /// Convert emitted tokens to booleans + /// + public static string ReturnTypeBool = "bool"; + + /// + /// AQL query to be executed + /// + public string QueryString { get; set; } + + /// + /// When true: set the position to 0 for all members + /// of the query result array. + /// When false: (default): set the position corresponding + /// to the index of the result array member + /// + public bool CollapsePositions { get; set; } + + /// + /// When true: (default): treat null like an empty string. + /// When false: discard nulls from View index. Can be used + /// for index filtering (i.e. make your query return null + /// for unwanted data). Note that empty results are always + /// discarded. + /// + public bool KeepNull { get; set; } + + /// + /// A number between 1 and 1000 (default = 1) that determines + /// the batch size for reading data from the query. In general, + /// a single token is expected to be returned. However, if the + /// query is expected to return many results, then increasing + /// trades memory for performance. + /// + public int BatchSize { get; set; } + + /// + /// Memory limit for query execution in bytes. + /// (default is 1048576 = 1Mb) + /// Maximum is 33554432U (32Mb) + /// + public int MemoryLimit { get; set; } + + /// + /// The Data type of the returned tokens. If the indicated + /// type does not match the actual type then an implicit + /// type conversion is applied. For possible values, see + /// , + /// and + /// + public string ReturnType { get; set; } + } +} diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/AnalyzerPropertiesBase.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/AnalyzerPropertiesBase.cs new file mode 100644 index 00000000..90b4ec2c --- /dev/null +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/AnalyzerPropertiesBase.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +{ + public class AnalyzerPropertiesBase + { + + } +} diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/ClassificationAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/ClassificationAnalyzer.cs new file mode 100644 index 00000000..c982b398 --- /dev/null +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/ClassificationAnalyzer.cs @@ -0,0 +1,33 @@ +using System; + +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +{ + /// + /// Properties for Classification analyzer. + /// (only available in the Enterprise Edition) + /// + public class ClassificationAnalyzer : AnalyzerPropertiesBase + { + /// + /// Required. 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. + /// + public string Model_Location { get; set; } + + /// + /// Optional. The number of class labels that will be + /// produced per input (default: 1). + /// + public int? Top_K { get; set; } + + /// + /// Optional. 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). + /// + public int? Threshold { get; set; } + } +} diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/CollationAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/CollationAnalyzer.cs new file mode 100644 index 00000000..d68c3cc3 --- /dev/null +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/CollationAnalyzer.cs @@ -0,0 +1,18 @@ +using System; + +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +{ + /// + /// Properties for Collation analyzer + /// + public class CollationAnalyzer : AnalyzerPropertiesBase + { + /// + /// A locale in the format language, e.g. "de" or "en". + /// The locale is forwarded to the Snowball stemmer + /// without checks. An invalid locale does not prevent + /// the creation of the Analyzer. + /// + public string Locale { get; set; } + } +} diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/DelimiterAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/DelimiterAnalyzer.cs new file mode 100644 index 00000000..aabdcb39 --- /dev/null +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/DelimiterAnalyzer.cs @@ -0,0 +1,15 @@ +using System; + +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +{ + /// + /// Properties for delimiter analyzer + /// + public class DelimiterAnalyzer : AnalyzerPropertiesBase + { + /// + /// The delimiting character(s) + /// + public string Delimiter { get; set; } + } +} diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzer.cs new file mode 100644 index 00000000..b24afebf --- /dev/null +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzer.cs @@ -0,0 +1,41 @@ +using System; + +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +{ + /// + /// Properties for GeoJSON analyzer. + /// + public class GeoJSONAnalyzer : AnalyzerPropertiesBase + { + /// + /// Index all GeoJSON geometry types (Point, Polygon etc.) + /// (default). + /// + public static string TypeShape = "shape"; + + /// + /// Compute and only index the centroid of the input + /// geometry + /// + public static string TypeCentroid = "centroid"; + + /// + /// Only index GeoJSON objects of type Point, ignore all + /// other geometry types + /// + public static string TypePoint = "point"; + + /// + /// Determines the type of indexing to use. + /// Possible values are , + /// and + /// + public string Type { get; set; } + + /// + /// Options for fine-tuning geo queries. + /// These options should generally remain unchanged. + /// + public GeoJSONAnalyzerOptions Options { get; set; } + } +} diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzerOptions.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzerOptions.cs new file mode 100644 index 00000000..c999a7a7 --- /dev/null +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzerOptions.cs @@ -0,0 +1,25 @@ +using System; + +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +{ + /// + /// Options for fine-tuning geo queries. + /// + public class GeoJSONAnalyzerOptions + { + /// + /// Maximum number of S2 cells (default: 20) + /// + public int? MaxCells { get; set; } + + /// + /// The least precise S2 level (default: 4) + /// + public int? MinLevel { get; set; } + + /// + /// The most precise S2 level (default: 23) + /// + public int? MaxLevel { get; set; } + } +} diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoPointAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoPointAnalyzer.cs new file mode 100644 index 00000000..86defcc2 --- /dev/null +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoPointAnalyzer.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; + +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +{ + /// + /// Properties for GeoPoint analyzer. + /// + public class GeoPointAnalyzer : AnalyzerPropertiesBase + { + /// + /// A list of strings that describes the attribute path + /// of the latitude value relative to the field for + /// which the Analyzer is defined in the View. + /// + public List Latitude { get; set; } + + /// + /// A list of strings that describes the attribute path + /// of the longitude value relative to the field for + /// which the Analyzer is defined in the View. + /// + public List Longitude { get; set; } + + /// + /// Options for fine-tuning geo queries. + /// These options should generally remain unchanged. + /// + public GeoJSONAnalyzerOptions Options { get; set; } + } +} diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/IdentityAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/IdentityAnalyzer.cs new file mode 100644 index 00000000..4199b60a --- /dev/null +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/IdentityAnalyzer.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; + +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +{ + /// + /// Properties for Identity analyzer + /// + public class IdentityAnalyzer : AnalyzerPropertiesBase + { + } +} diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/MinhashAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/MinhashAnalyzer.cs new file mode 100644 index 00000000..f9032506 --- /dev/null +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/MinhashAnalyzer.cs @@ -0,0 +1,25 @@ +using System; + +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +{ + /// + /// Properties for Minhash analyzer. + /// (only available in the Enterprise Edition) + /// + public class MinhashAnalyzer : AnalyzerPropertiesBase + { + /// + /// An Analyzer object. + /// + public Analyzer Analyzer { get; set; } + + /// + /// The size of the MinHash 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. + /// + public int NumHashes { get; set; } + } +} diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NearestNeighborsAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NearestNeighborsAnalyzer.cs new file mode 100644 index 00000000..37346af9 --- /dev/null +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NearestNeighborsAnalyzer.cs @@ -0,0 +1,24 @@ +using System; + +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +{ + /// + /// Properties for nearest_neighbors analyzer. + /// + public class NearestNeighborsAnalyzer : AnalyzerPropertiesBase + { + /// + /// Required. 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. + /// + public string Model_Location { get; set; } + + /// + /// Optional. The number of class labels that will be + /// produced per input (default: 1). + /// + public int? Top_K { get; set; } + } +} diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NgramAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NgramAnalyzer.cs new file mode 100644 index 00000000..f87330c3 --- /dev/null +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NgramAnalyzer.cs @@ -0,0 +1,60 @@ +using System; + +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +{ + /// + /// Properties for ngram analyzer + /// + public class NgramAnalyzer + { + /// + /// One byte is considered as one character (default) + /// + public static string StreamTypeBinary = "binary"; + + /// + /// One Unicode codepoint is treated as one character + /// + public static string StreamTypeUTF8 = "utf8"; + + /// + /// Unsigned integer for the minimum n-gram length + /// + public int Min { get; set; } + + /// + /// Unsigned integer for the maximum n-gram length + /// + public int Max { get; set; } + + /// + /// When true: include the original value as well. + /// When false: produce the n-grams based on + /// and only. + /// + public bool PreserveOriginal { get; set; } + + /// + /// This value will be prepended to n-grams which + /// include the beginning of the input. Can be used + /// for matching prefixes. Choose a character or + /// sequence as marker which does not occur in the input. + /// + public string StartMarker { get; set; } + + /// + /// This value will be appended to n-grams which + /// include the end of the input. Can be used for + /// matching suffixes. Choose a character or sequence + /// as marker which does not occur in the input. + /// + public string EndMarker { get; set; } + + /// + /// Type of the input stream. + /// Possible values are + /// and + /// + public string StreamType { get; set; } + } +} diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NormAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NormAnalyzer.cs new file mode 100644 index 00000000..88836b59 --- /dev/null +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NormAnalyzer.cs @@ -0,0 +1,48 @@ +using System; + +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +{ + /// + /// Properties for norm analyzer + /// + public class NormAnalyzer : AnalyzerPropertiesBase + { + /// + /// Convert to all lower-case characters + /// + public static string CaseHandlingLower = "lower"; + + /// + /// Convert to all upper-case characters + /// + public static string CaseHandlingUpper = "upper"; + + /// + /// Do not change character case (default) + /// + public static string CaseHandlingNone = "none"; + + /// + /// A locale in the format language[_COUNTRY] + /// (square brackets denote optional parts), + /// e.g. "de" or "en_US". The locale is forwarded + /// to ICU without checks. An invalid locale does + /// not prevent the creation of the Analyzer. + /// + public string Locale { get; set; } + + /// + /// When true: preserves accented characters (default). + /// When false: converts accented characters to their + /// base characters. + /// + public bool? Accent { get; set; } + + /// + /// Determines how to handle character casing + /// Possible values are , + /// , and + /// + public string Case { get; set; } + } +} diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/PipelineAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/PipelineAnalyzer.cs new file mode 100644 index 00000000..53e64ff0 --- /dev/null +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/PipelineAnalyzer.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; + +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +{ + /// + /// Properties for Pipeline analyzer + /// + public class PipelineAnalyzer : AnalyzerPropertiesBase + { + /// + /// An array of Analyzer objects to use for the pipeline. + /// Analyzers of types geopoint and geojson cannot be used + /// in pipelines and will make the creation fail. + /// These Analyzers require additional postprocessing and + /// can only be applied to document fields directly. + /// + public List Pipeline { get; set; } + } +} diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/SegmentationAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/SegmentationAnalyzer.cs new file mode 100644 index 00000000..a8ba6436 --- /dev/null +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/SegmentationAnalyzer.cs @@ -0,0 +1,59 @@ +using System; + +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +{ + /// + /// Properties for Segmentation analyzer + /// + public class SegmentationAnalyzer : AnalyzerPropertiesBase + { + /// + /// Convert to all lower-case characters + /// + public static string CaseHandlingLower = "lower"; + + /// + /// Convert to all upper-case characters + /// + public static string CaseHandlingUpper = "upper"; + + /// + /// Do not change character case (default) + /// + public static string CaseHandlingNone = "none"; + + /// + /// Return all tokens + /// + public static string BreakTypeAll = "all"; + + /// + /// Return tokens composed of alphanumeric characters only (default). + /// + public static string BreakTypeAlpha = "alpha"; + + /// + /// Return tokens composed of non-whitespace characters only. + /// Note that the list of whitespace characters does not include line breaks: + /// U+0009 Character Tabulation, U+0020 Space, U+0085 Next Line, + /// U+00A0 No-break Space, U+1680 Ogham Space Mark, U+2000 En Quad, + /// U+2028 Line Separator, U+202F Narrow No-break Space, + /// U+205F Medium Mathematical Space, and U+3000 Ideographic Space. + /// + public static string BreakTypeGraphic = "graphic"; + + /// + /// Determines how to break up the input text. + /// Possible values are , , + /// and + /// + public string Break { get; set; } + + /// + /// Determines how to handle character casing + /// Possible values are , + /// , and + /// + public string Case { get; set; } + } +} diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/StemAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/StemAnalyzer.cs new file mode 100644 index 00000000..76c1102f --- /dev/null +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/StemAnalyzer.cs @@ -0,0 +1,18 @@ +using System; + +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +{ + /// + /// Properties for Stem analyzer + /// + public class StemAnalyzer : AnalyzerPropertiesBase + { + /// + /// A locale in the format language, e.g. "de" or "en". + /// The locale is forwarded to the Snowball stemmer + /// without checks. An invalid locale does not prevent + /// the creation of the Analyzer. + /// + public string Locale { get; set; } + } +} diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/StopwordsAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/StopwordsAnalyzer.cs new file mode 100644 index 00000000..54e105b8 --- /dev/null +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/StopwordsAnalyzer.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +{ + /// + /// Properties for Stopwords analyzer + /// + public class StopwordsAnalyzer : AnalyzerPropertiesBase + { + /// + /// A list of strings that describe the tokens to be discarded. + /// The interpretation of each string depends on the value of + /// the property. + /// + public List Stopwords { get; set; } + + /// + /// If false (default), then each string in + /// is used verbatim. If true, then the strings need to be hex-encoded. + /// This allows for removing tokens that contain non-printable characters. + /// + public bool Hex { get; set; } + } +} diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzer.cs new file mode 100644 index 00000000..428dda06 --- /dev/null +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzer.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; + +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +{ + /// + /// Properties for text analyzer + /// + public class TextAnalyzer + { + /// + /// Convert to all lower-case characters + /// + public static string CaseHandlingLower = "lower"; + + /// + /// Convert to all upper-case characters + /// + public static string CaseHandlingUpper = "upper"; + + /// + /// Do not change character case (default) + /// + public static string CaseHandlingNone = "none"; + + /// + /// A locale in the format language[_COUNTRY] + /// (square brackets denote optional parts), + /// e.g. "de" or "en_US". The locale is forwarded + /// to ICU without checks. An invalid locale does + /// not prevent the creation of the Analyzer. + /// + public string Locale { get; set; } + + /// + /// When true: preserves accented characters (default). + /// When false: converts accented characters to their + /// base characters. + /// + public bool? Accent { get; set; } + + /// + /// Determines how to handle character casing + /// Possible values are , + /// , and + /// + public string Case { get; set; } + + /// + /// When true: apply stemming on returned words (default). + /// When false: leave the tokenized words as-is. + /// + public bool? Stemming { get; set; } + + /// + /// If present, then edge n-grams are generated for + /// each token (word). That is, the start of the + /// n-gram is anchored to the beginning of the token, + /// whereas the ngram Analyzer would produce all possible + /// substrings from a single input token (within the + /// defined length restrictions). Edge n-grams can be + /// used to cover word-based auto-completion queries + /// with an index, for which you should set the following + /// other options: = false, + /// = + /// and most importantly = false. + /// + public TextAnalyzerEdgeNgram EdgeNgram { get; set; } + + /// + /// A list of strings with words to omit from result. + /// Default: load words from . + /// To disable stop-word filtering provide an empty list. + /// If both and + /// are provided then both word sources are combined. + /// + public List Stopwords { get; set; } + + /// + /// A path with a language sub-directory (e.g. en for a locale en_US) + /// containing files with words to omit. Each word has to be on a + /// separate line. Everything after the first whitespace character + /// on a line will be ignored and can be used for comments. The files + /// can be named arbitrarily and have any file extension (or none). + /// Default: if no path is provided then the value of the environment + /// variable IRESEARCH_TEXT_STOPWORD_PATH is used to determine the path, + /// or if it is undefined then the current working directory is assumed. + /// If the stopwords attribute is provided then no stop-words are loaded + /// from files, unless an explicit is also provided. + /// Note that if the can not be accessed, + /// is missing language sub-directories or has no files for a language + /// required by an Analyzer, then the creation of a new Analyzer + /// is refused. If such an issue is discovered for an existing Analyzer + /// during startup then the server will abort with a fatal error. + /// + public string StopwordsPath { get; set; } + } +} diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzerEdgeNgram.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzerEdgeNgram.cs new file mode 100644 index 00000000..8f745883 --- /dev/null +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzerEdgeNgram.cs @@ -0,0 +1,27 @@ +using System; + +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +{ + /// + /// + /// + public class TextAnalyzerEdgeNgram + { + /// + /// Minimal n-gram length + /// + public int Min { get; set; } + + /// + /// Maximal n-gram length + /// + public int Max { get; set; } + + /// + /// Whether to include the original token + /// even if its length is less than + /// or greater than + /// + public bool PreserveOriginal { get; set; } + } +} From a02ae7ad80f9b8a57c2f56cdd4c6d19b6b35dd31 Mon Sep 17 00:00:00 2001 From: tjoubert Date: Wed, 21 Dec 2022 14:58:35 +0400 Subject: [PATCH 2/5] Added inheritance and cleaned the tests --- .../AnalyzerApi/AnalyzerApiClientTest.cs | 26 +------------------ .../GeoJSONAnalyzerOptions.cs | 2 +- .../AnalyzerProperties/NgramAnalyzer.cs | 2 +- .../Models/AnalyzerProperties/TextAnalyzer.cs | 2 +- .../TextAnalyzerEdgeNgram.cs | 2 +- 5 files changed, 5 insertions(+), 29 deletions(-) diff --git a/arangodb-net-standard.Test/AnalyzerApi/AnalyzerApiClientTest.cs b/arangodb-net-standard.Test/AnalyzerApi/AnalyzerApiClientTest.cs index 073b55fd..ead677f7 100644 --- a/arangodb-net-standard.Test/AnalyzerApi/AnalyzerApiClientTest.cs +++ b/arangodb-net-standard.Test/AnalyzerApi/AnalyzerApiClientTest.cs @@ -47,14 +47,6 @@ public async Task PostAnalyzerAsync_ShouldSucceed() { Name = "text_sc", Type = "identity", - Properties = new AnalyzerProperties() - { - Accent = false, - Case = "lower", - Locale = "sc", - Stemming = false, - StopWords = new List() - }, Features = new List() { "frequency", @@ -78,15 +70,7 @@ public async Task PostAnalyzerAsync_ShouldThrow_WhenAnalyzerIsInvalid() new Analyzer() { Name = "text_sc", - Type = "collection", //...invalid analyzer type - Properties = new AnalyzerProperties() - { - Accent = false, - Case = "lower", - Locale = "sc", - Stemming = false, - StopWords = new List() - }, + Type = "collection", Features = new List() { "frequency", @@ -125,14 +109,6 @@ public async Task DeleteAnalyzerAsync_ShouldSucceed() { Name = name, Type = "identity", - Properties = new AnalyzerProperties() - { - Accent = false, - Case = "lower", - Locale = "mu", - Stemming = false, - StopWords = new List() - }, Features = new List() { "frequency", diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzerOptions.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzerOptions.cs index c999a7a7..4547a9a5 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzerOptions.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzerOptions.cs @@ -5,7 +5,7 @@ namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties /// /// Options for fine-tuning geo queries. /// - public class GeoJSONAnalyzerOptions + public class GeoJSONAnalyzerOptions : AnalyzerPropertiesBase { /// /// Maximum number of S2 cells (default: 20) diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NgramAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NgramAnalyzer.cs index f87330c3..05e975b4 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NgramAnalyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NgramAnalyzer.cs @@ -5,7 +5,7 @@ namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties /// /// Properties for ngram analyzer /// - public class NgramAnalyzer + public class NgramAnalyzer : AnalyzerPropertiesBase { /// /// One byte is considered as one character (default) diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzer.cs index 428dda06..2e2767e2 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzer.cs @@ -6,7 +6,7 @@ namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties /// /// Properties for text analyzer /// - public class TextAnalyzer + public class TextAnalyzer:AnalyzerPropertiesBase { /// /// Convert to all lower-case characters diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzerEdgeNgram.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzerEdgeNgram.cs index 8f745883..ff3a3a4f 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzerEdgeNgram.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzerEdgeNgram.cs @@ -5,7 +5,7 @@ namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties /// /// /// - public class TextAnalyzerEdgeNgram + public class TextAnalyzerEdgeNgram : AnalyzerPropertiesBase { /// /// Minimal n-gram length From 904728e0b976df7cbbd761e1e7403d1bc1f6d89b Mon Sep 17 00:00:00 2001 From: tjoubert Date: Wed, 21 Dec 2022 19:39:04 +0400 Subject: [PATCH 3/5] Fixes after review --- .../Models/AnalyzerProperties/AQLAnalyzer.cs | 6 +++--- .../AnalyzerProperties/AnalyzerPropertiesBase.cs | 5 ++++- .../Models/AnalyzerProperties/GeoJSONAnalyzer.cs | 6 +++--- .../AnalyzerProperties/GeoJSONAnalyzerOptions.cs | 2 +- .../Models/AnalyzerProperties/NgramAnalyzer.cs | 4 ++-- .../Models/AnalyzerProperties/NormAnalyzer.cs | 6 +++--- .../AnalyzerProperties/SegmentationAnalyzer.cs | 12 ++++++------ .../Models/AnalyzerProperties/TextAnalyzer.cs | 6 +++--- .../AnalyzerProperties/TextAnalyzerEdgeNgram.cs | 2 +- 9 files changed, 26 insertions(+), 23 deletions(-) diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/AQLAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/AQLAnalyzer.cs index f123c1f3..e9cc39eb 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/AQLAnalyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/AQLAnalyzer.cs @@ -10,17 +10,17 @@ public class AQLAnalyzer : AnalyzerPropertiesBase /// /// Convert emitted tokens to strings. (default) /// - public static string ReturnTypeString = "string"; + public const string ReturnTypeString = "string"; /// /// Convert emitted tokens to numbers /// - public static string ReturnTypeNumber = "number"; + public const string ReturnTypeNumber = "number"; /// /// Convert emitted tokens to booleans /// - public static string ReturnTypeBool = "bool"; + public const string ReturnTypeBool = "bool"; /// /// AQL query to be executed diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/AnalyzerPropertiesBase.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/AnalyzerPropertiesBase.cs index 90b4ec2c..96b094ba 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/AnalyzerPropertiesBase.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/AnalyzerPropertiesBase.cs @@ -4,7 +4,10 @@ namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties { - public class AnalyzerPropertiesBase + /// + /// Base class for analyzer properties + /// + public abstract class AnalyzerPropertiesBase { } diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzer.cs index b24afebf..676e2378 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzer.cs @@ -11,19 +11,19 @@ public class GeoJSONAnalyzer : AnalyzerPropertiesBase /// Index all GeoJSON geometry types (Point, Polygon etc.) /// (default). /// - public static string TypeShape = "shape"; + public const string TypeShape = "shape"; /// /// Compute and only index the centroid of the input /// geometry /// - public static string TypeCentroid = "centroid"; + public const string TypeCentroid = "centroid"; /// /// Only index GeoJSON objects of type Point, ignore all /// other geometry types /// - public static string TypePoint = "point"; + public const string TypePoint = "point"; /// /// Determines the type of indexing to use. diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzerOptions.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzerOptions.cs index 4547a9a5..86466a0f 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzerOptions.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzerOptions.cs @@ -5,7 +5,7 @@ namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties /// /// Options for fine-tuning geo queries. /// - public class GeoJSONAnalyzerOptions : AnalyzerPropertiesBase + public class GeoJSONAnalyzerOptions { /// /// Maximum number of S2 cells (default: 20) diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NgramAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NgramAnalyzer.cs index 05e975b4..250334b1 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NgramAnalyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NgramAnalyzer.cs @@ -10,12 +10,12 @@ public class NgramAnalyzer : AnalyzerPropertiesBase /// /// One byte is considered as one character (default) /// - public static string StreamTypeBinary = "binary"; + public const string StreamTypeBinary = "binary"; /// /// One Unicode codepoint is treated as one character /// - public static string StreamTypeUTF8 = "utf8"; + public const string StreamTypeUTF8 = "utf8"; /// /// Unsigned integer for the minimum n-gram length diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NormAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NormAnalyzer.cs index 88836b59..0b0e3e48 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NormAnalyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NormAnalyzer.cs @@ -10,17 +10,17 @@ public class NormAnalyzer : AnalyzerPropertiesBase /// /// Convert to all lower-case characters /// - public static string CaseHandlingLower = "lower"; + public const string CaseHandlingLower = "lower"; /// /// Convert to all upper-case characters /// - public static string CaseHandlingUpper = "upper"; + public const string CaseHandlingUpper = "upper"; /// /// Do not change character case (default) /// - public static string CaseHandlingNone = "none"; + public const string CaseHandlingNone = "none"; /// /// A locale in the format language[_COUNTRY] diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/SegmentationAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/SegmentationAnalyzer.cs index a8ba6436..5f5040c5 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/SegmentationAnalyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/SegmentationAnalyzer.cs @@ -10,27 +10,27 @@ public class SegmentationAnalyzer : AnalyzerPropertiesBase /// /// Convert to all lower-case characters /// - public static string CaseHandlingLower = "lower"; + public const string CaseHandlingLower = "lower"; /// /// Convert to all upper-case characters /// - public static string CaseHandlingUpper = "upper"; + public const string CaseHandlingUpper = "upper"; /// /// Do not change character case (default) /// - public static string CaseHandlingNone = "none"; + public const string CaseHandlingNone = "none"; /// /// Return all tokens /// - public static string BreakTypeAll = "all"; + public const string BreakTypeAll = "all"; /// /// Return tokens composed of alphanumeric characters only (default). /// - public static string BreakTypeAlpha = "alpha"; + public const string BreakTypeAlpha = "alpha"; /// /// Return tokens composed of non-whitespace characters only. @@ -40,7 +40,7 @@ public class SegmentationAnalyzer : AnalyzerPropertiesBase /// U+2028 Line Separator, U+202F Narrow No-break Space, /// U+205F Medium Mathematical Space, and U+3000 Ideographic Space. /// - public static string BreakTypeGraphic = "graphic"; + public const string BreakTypeGraphic = "graphic"; /// /// Determines how to break up the input text. diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzer.cs index 2e2767e2..230e205a 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzer.cs @@ -11,17 +11,17 @@ public class TextAnalyzer:AnalyzerPropertiesBase /// /// Convert to all lower-case characters /// - public static string CaseHandlingLower = "lower"; + public const string CaseHandlingLower = "lower"; /// /// Convert to all upper-case characters /// - public static string CaseHandlingUpper = "upper"; + public const string CaseHandlingUpper = "upper"; /// /// Do not change character case (default) /// - public static string CaseHandlingNone = "none"; + public const string CaseHandlingNone = "none"; /// /// A locale in the format language[_COUNTRY] diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzerEdgeNgram.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzerEdgeNgram.cs index ff3a3a4f..c958de21 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzerEdgeNgram.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzerEdgeNgram.cs @@ -5,7 +5,7 @@ namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties /// /// /// - public class TextAnalyzerEdgeNgram : AnalyzerPropertiesBase + public class TextAnalyzerEdgeNgram { /// /// Minimal n-gram length From 493929878b29d33be28611644a6aa6ebdc687bd1 Mon Sep 17 00:00:00 2001 From: tjoubert Date: Wed, 21 Dec 2022 19:46:23 +0400 Subject: [PATCH 4/5] Made AnalyzerPropertiesBase a normal class for deserialization --- .../Models/AnalyzerProperties/AnalyzerPropertiesBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/AnalyzerPropertiesBase.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/AnalyzerPropertiesBase.cs index 96b094ba..80d4b98a 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/AnalyzerPropertiesBase.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/AnalyzerPropertiesBase.cs @@ -7,7 +7,7 @@ namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties /// /// Base class for analyzer properties /// - public abstract class AnalyzerPropertiesBase + public class AnalyzerPropertiesBase { } From 92e7e5cbd4944d83cf8c756e2f8d5ad59d4f3086 Mon Sep 17 00:00:00 2001 From: tjoubert Date: Mon, 23 Jan 2023 11:59:14 +0400 Subject: [PATCH 5/5] Refactored analyzer definition and response classes --- .../AnalyzerApi/AnalyzerApiClient.cs | 4 +- .../AnalyzerApi/IAnalyzerApiClient.cs | 4 +- .../AnalyzerApi/Models/Analyzer.cs | 40 +- .../AnalyzerApi/Models/AnalyzerDefinition.cs | 47 +++ .../AQLAnalyzer.cs | 4 +- .../AnalyzerPropertiesBase.cs | 4 +- .../ClassificationAnalyzer.cs | 4 +- .../CollationAnalyzer.cs | 4 +- .../DelimiterAnalyzer.cs | 4 +- .../GeoJSONAnalyzer.cs | 4 +- .../GeoPointAnalyzer.cs | 4 +- .../IdentityAnalyzer.cs | 4 +- .../MinhashAnalyzer.cs | 4 +- .../NearestNeighborsAnalyzer.cs | 4 +- .../NgramAnalyzer.cs | 4 +- .../NormAnalyzer.cs | 4 +- .../PipelineAnalyzer.cs | 4 +- .../SegmentationAnalyzer.cs | 4 +- .../StemAnalyzer.cs | 4 +- .../StopwordsAnalyzer.cs | 4 +- .../TextAnalyzer.cs | 4 +- .../AnalyzerApi/Models/AnalyzerProperties.cs | 372 ++++++++++++++++++ .../GeoJSONAnalyzerOptions.cs | 4 +- .../TextAnalyzerEdgeNgram.cs | 4 +- 24 files changed, 465 insertions(+), 78 deletions(-) create mode 100644 arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinition.cs rename arangodb-net-standard/AnalyzerApi/Models/{AnalyzerProperties => AnalyzerDefinitionProperties}/AQLAnalyzer.cs (94%) rename arangodb-net-standard/AnalyzerApi/Models/{AnalyzerProperties => AnalyzerDefinitionProperties}/AnalyzerPropertiesBase.cs (56%) rename arangodb-net-standard/AnalyzerApi/Models/{AnalyzerProperties => AnalyzerDefinitionProperties}/ClassificationAnalyzer.cs (86%) rename arangodb-net-standard/AnalyzerApi/Models/{AnalyzerProperties => AnalyzerDefinitionProperties}/CollationAnalyzer.cs (74%) rename arangodb-net-standard/AnalyzerApi/Models/{AnalyzerProperties => AnalyzerDefinitionProperties}/DelimiterAnalyzer.cs (62%) rename arangodb-net-standard/AnalyzerApi/Models/{AnalyzerProperties => AnalyzerDefinitionProperties}/GeoJSONAnalyzer.cs (88%) rename arangodb-net-standard/AnalyzerApi/Models/{AnalyzerProperties => AnalyzerDefinitionProperties}/GeoPointAnalyzer.cs (86%) rename arangodb-net-standard/AnalyzerApi/Models/{AnalyzerProperties => AnalyzerDefinitionProperties}/IdentityAnalyzer.cs (56%) rename arangodb-net-standard/AnalyzerApi/Models/{AnalyzerProperties => AnalyzerDefinitionProperties}/MinhashAnalyzer.cs (82%) rename arangodb-net-standard/AnalyzerApi/Models/{AnalyzerProperties => AnalyzerDefinitionProperties}/NearestNeighborsAnalyzer.cs (80%) rename arangodb-net-standard/AnalyzerApi/Models/{AnalyzerProperties => AnalyzerDefinitionProperties}/NgramAnalyzer.cs (92%) rename arangodb-net-standard/AnalyzerApi/Models/{AnalyzerProperties => AnalyzerDefinitionProperties}/NormAnalyzer.cs (91%) rename arangodb-net-standard/AnalyzerApi/Models/{AnalyzerProperties => AnalyzerDefinitionProperties}/PipelineAnalyzer.cs (79%) rename arangodb-net-standard/AnalyzerApi/Models/{AnalyzerProperties => AnalyzerDefinitionProperties}/SegmentationAnalyzer.cs (92%) rename arangodb-net-standard/AnalyzerApi/Models/{AnalyzerProperties => AnalyzerDefinitionProperties}/StemAnalyzer.cs (74%) rename arangodb-net-standard/AnalyzerApi/Models/{AnalyzerProperties => AnalyzerDefinitionProperties}/StopwordsAnalyzer.cs (83%) rename arangodb-net-standard/AnalyzerApi/Models/{AnalyzerProperties => AnalyzerDefinitionProperties}/TextAnalyzer.cs (96%) create mode 100644 arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties.cs rename arangodb-net-standard/AnalyzerApi/Models/{AnalyzerProperties => }/GeoJSONAnalyzerOptions.cs (83%) rename arangodb-net-standard/AnalyzerApi/Models/{AnalyzerProperties => }/TextAnalyzerEdgeNgram.cs (84%) diff --git a/arangodb-net-standard/AnalyzerApi/AnalyzerApiClient.cs b/arangodb-net-standard/AnalyzerApi/AnalyzerApiClient.cs index 5ea10d02..29877bfa 100644 --- a/arangodb-net-standard/AnalyzerApi/AnalyzerApiClient.cs +++ b/arangodb-net-standard/AnalyzerApi/AnalyzerApiClient.cs @@ -72,10 +72,10 @@ public virtual async Task GetAllAnalyzersAsync(Cancella /// Creates a new Analyzer based on the provided definition /// POST /_api/analyzer /// - /// The properties of the new analyzer. + /// The definition of the new analyzer. /// A CancellationToken to observe while waiting for the task to complete or to cancel the task. /// - public virtual async Task PostAnalyzerAsync(Analyzer body, CancellationToken token = default) + public virtual async Task PostAnalyzerAsync(AnalyzerDefinition body, CancellationToken token = default) { if (body == null) { diff --git a/arangodb-net-standard/AnalyzerApi/IAnalyzerApiClient.cs b/arangodb-net-standard/AnalyzerApi/IAnalyzerApiClient.cs index da04fa80..7ee0a2fb 100644 --- a/arangodb-net-standard/AnalyzerApi/IAnalyzerApiClient.cs +++ b/arangodb-net-standard/AnalyzerApi/IAnalyzerApiClient.cs @@ -21,10 +21,10 @@ public interface IAnalyzerApiClient /// Creates a new Analyzer based on the provided definition /// POST /_api/analyzer /// - /// The properties of the new analyzer. + /// The definition of the new analyzer. /// A CancellationToken to observe while waiting for the task to complete or to cancel the task. /// - Task PostAnalyzerAsync(Analyzer body, CancellationToken token = default); + Task PostAnalyzerAsync(AnalyzerDefinition body, CancellationToken token = default); /// /// Fetches the definition of the specified analyzer. diff --git a/arangodb-net-standard/AnalyzerApi/Models/Analyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/Analyzer.cs index 8235fc96..ff6f9ba3 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/Analyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/Analyzer.cs @@ -1,47 +1,15 @@ -using ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties; -using System.Collections.Generic; +using System.Collections.Generic; namespace ArangoDBNetStandard.AnalyzerApi.Models { /// /// Defines an Analyzer in the database /// - public class Analyzer + public class Analyzer: AnalyzerDefinition { /// - /// Name of the analyzer - /// For rules regarding analyzer names, see - /// https://www.arangodb.com/docs/stable/analyzers.html#analyzer-names + /// Properties of the analyzer /// - public string Name { get; set; } - - /// - /// Type of the analyzer - /// For valid analyzer types, see - /// https://www.arangodb.com/docs/stable/analyzers.html#analyzer-types - /// - public string Type { get; set; } - - /// - /// Properties of the analyzer - /// used to configure the specified type - /// - public AnalyzerPropertiesBase Properties { get; set; } - - /// - /// The set of features to set on - /// the Analyzer generated fields. - /// Determines what term matching - /// capabilities will be available. - /// Possible features: - /// frequency: how often a term is seen, required for PHRASE(). - /// norm: the field normalization factor. - /// 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; } + public new AnalyzerProperties Properties { get; set; } } } \ No newline at end of file diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinition.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinition.cs new file mode 100644 index 00000000..4293fc56 --- /dev/null +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinition.cs @@ -0,0 +1,47 @@ +using ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerDefinitionProperties; +using System.Collections.Generic; + +namespace ArangoDBNetStandard.AnalyzerApi.Models +{ + /// + /// Defines an Analyzer in the database + /// + public class AnalyzerDefinition + { + /// + /// Name of the analyzer + /// For rules regarding analyzer names, see + /// https://www.arangodb.com/docs/stable/analyzers.html#analyzer-names + /// + public string Name { get; set; } + + /// + /// Type of the analyzer + /// For valid analyzer types, see + /// https://www.arangodb.com/docs/stable/analyzers.html#analyzer-types + /// + public string Type { get; set; } + + /// + /// Properties of the analyzer + /// used to configure the specified + /// + public AnalyzerDefinitionPropertiesBase Properties { get; set; } + + /// + /// The set of features to set on + /// the Analyzer generated fields. + /// Determines what term matching + /// capabilities will be available. + /// Possible features: + /// frequency: how often a term is seen, required for PHRASE(). + /// norm: the field normalization factor. + /// 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; } + } +} \ No newline at end of file diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/AQLAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/AQLAnalyzer.cs similarity index 94% rename from arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/AQLAnalyzer.cs rename to arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/AQLAnalyzer.cs index e9cc39eb..a89f9f8c 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/AQLAnalyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/AQLAnalyzer.cs @@ -1,11 +1,11 @@ using System; -namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerDefinitionProperties { /// /// Properties for AQL analyzer /// - public class AQLAnalyzer : AnalyzerPropertiesBase + public class AQLAnalyzer : AnalyzerDefinitionPropertiesBase { /// /// Convert emitted tokens to strings. (default) diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/AnalyzerPropertiesBase.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/AnalyzerPropertiesBase.cs similarity index 56% rename from arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/AnalyzerPropertiesBase.cs rename to arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/AnalyzerPropertiesBase.cs index 80d4b98a..5f9f6b6a 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/AnalyzerPropertiesBase.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/AnalyzerPropertiesBase.cs @@ -2,12 +2,12 @@ using System.Collections.Generic; using System.Text; -namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerDefinitionProperties { /// /// Base class for analyzer properties /// - public class AnalyzerPropertiesBase + public class AnalyzerDefinitionPropertiesBase { } diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/ClassificationAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/ClassificationAnalyzer.cs similarity index 86% rename from arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/ClassificationAnalyzer.cs rename to arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/ClassificationAnalyzer.cs index c982b398..eb986923 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/ClassificationAnalyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/ClassificationAnalyzer.cs @@ -1,12 +1,12 @@ using System; -namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerDefinitionProperties { /// /// Properties for Classification analyzer. /// (only available in the Enterprise Edition) /// - public class ClassificationAnalyzer : AnalyzerPropertiesBase + public class ClassificationAnalyzer : AnalyzerDefinitionPropertiesBase { /// /// Required. The on-disk path to the trained fastText diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/CollationAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/CollationAnalyzer.cs similarity index 74% rename from arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/CollationAnalyzer.cs rename to arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/CollationAnalyzer.cs index d68c3cc3..ee172fd4 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/CollationAnalyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/CollationAnalyzer.cs @@ -1,11 +1,11 @@ using System; -namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerDefinitionProperties { /// /// Properties for Collation analyzer /// - public class CollationAnalyzer : AnalyzerPropertiesBase + public class CollationAnalyzer : AnalyzerDefinitionPropertiesBase { /// /// A locale in the format language, e.g. "de" or "en". diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/DelimiterAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/DelimiterAnalyzer.cs similarity index 62% rename from arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/DelimiterAnalyzer.cs rename to arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/DelimiterAnalyzer.cs index aabdcb39..30fc84e3 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/DelimiterAnalyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/DelimiterAnalyzer.cs @@ -1,11 +1,11 @@ using System; -namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerDefinitionProperties { /// /// Properties for delimiter analyzer /// - public class DelimiterAnalyzer : AnalyzerPropertiesBase + public class DelimiterAnalyzer : AnalyzerDefinitionPropertiesBase { /// /// The delimiting character(s) diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/GeoJSONAnalyzer.cs similarity index 88% rename from arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzer.cs rename to arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/GeoJSONAnalyzer.cs index 676e2378..7c5274b2 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/GeoJSONAnalyzer.cs @@ -1,11 +1,11 @@ using System; -namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerDefinitionProperties { /// /// Properties for GeoJSON analyzer. /// - public class GeoJSONAnalyzer : AnalyzerPropertiesBase + public class GeoJSONAnalyzer : AnalyzerDefinitionPropertiesBase { /// /// Index all GeoJSON geometry types (Point, Polygon etc.) diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoPointAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/GeoPointAnalyzer.cs similarity index 86% rename from arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoPointAnalyzer.cs rename to arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/GeoPointAnalyzer.cs index 86defcc2..2e903cef 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoPointAnalyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/GeoPointAnalyzer.cs @@ -1,11 +1,11 @@ using System.Collections.Generic; -namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerDefinitionProperties { /// /// Properties for GeoPoint analyzer. /// - public class GeoPointAnalyzer : AnalyzerPropertiesBase + public class GeoPointAnalyzer : AnalyzerDefinitionPropertiesBase { /// /// A list of strings that describes the attribute path diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/IdentityAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/IdentityAnalyzer.cs similarity index 56% rename from arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/IdentityAnalyzer.cs rename to arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/IdentityAnalyzer.cs index 4199b60a..cf102993 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/IdentityAnalyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/IdentityAnalyzer.cs @@ -3,12 +3,12 @@ using System.Reflection; using System.Text; -namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerDefinitionProperties { /// /// Properties for Identity analyzer /// - public class IdentityAnalyzer : AnalyzerPropertiesBase + public class IdentityAnalyzer : AnalyzerDefinitionPropertiesBase { } } diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/MinhashAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/MinhashAnalyzer.cs similarity index 82% rename from arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/MinhashAnalyzer.cs rename to arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/MinhashAnalyzer.cs index f9032506..ec3153bd 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/MinhashAnalyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/MinhashAnalyzer.cs @@ -1,12 +1,12 @@ using System; -namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerDefinitionProperties { /// /// Properties for Minhash analyzer. /// (only available in the Enterprise Edition) /// - public class MinhashAnalyzer : AnalyzerPropertiesBase + public class MinhashAnalyzer : AnalyzerDefinitionPropertiesBase { /// /// An Analyzer object. diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NearestNeighborsAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/NearestNeighborsAnalyzer.cs similarity index 80% rename from arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NearestNeighborsAnalyzer.cs rename to arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/NearestNeighborsAnalyzer.cs index 37346af9..de31e1fd 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NearestNeighborsAnalyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/NearestNeighborsAnalyzer.cs @@ -1,11 +1,11 @@ using System; -namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerDefinitionProperties { /// /// Properties for nearest_neighbors analyzer. /// - public class NearestNeighborsAnalyzer : AnalyzerPropertiesBase + public class NearestNeighborsAnalyzer : AnalyzerDefinitionPropertiesBase { /// /// Required. The on-disk path to the trained fastText diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NgramAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/NgramAnalyzer.cs similarity index 92% rename from arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NgramAnalyzer.cs rename to arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/NgramAnalyzer.cs index 250334b1..aa61800a 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NgramAnalyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/NgramAnalyzer.cs @@ -1,11 +1,11 @@ using System; -namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerDefinitionProperties { /// /// Properties for ngram analyzer /// - public class NgramAnalyzer : AnalyzerPropertiesBase + public class NgramAnalyzer : AnalyzerDefinitionPropertiesBase { /// /// One byte is considered as one character (default) diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NormAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/NormAnalyzer.cs similarity index 91% rename from arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NormAnalyzer.cs rename to arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/NormAnalyzer.cs index 0b0e3e48..10ef2792 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/NormAnalyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/NormAnalyzer.cs @@ -1,11 +1,11 @@ using System; -namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerDefinitionProperties { /// /// Properties for norm analyzer /// - public class NormAnalyzer : AnalyzerPropertiesBase + public class NormAnalyzer : AnalyzerDefinitionPropertiesBase { /// /// Convert to all lower-case characters diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/PipelineAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/PipelineAnalyzer.cs similarity index 79% rename from arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/PipelineAnalyzer.cs rename to arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/PipelineAnalyzer.cs index 53e64ff0..0d1752ee 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/PipelineAnalyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/PipelineAnalyzer.cs @@ -1,12 +1,12 @@ using System; using System.Collections.Generic; -namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerDefinitionProperties { /// /// Properties for Pipeline analyzer /// - public class PipelineAnalyzer : AnalyzerPropertiesBase + public class PipelineAnalyzer : AnalyzerDefinitionPropertiesBase { /// /// An array of Analyzer objects to use for the pipeline. diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/SegmentationAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/SegmentationAnalyzer.cs similarity index 92% rename from arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/SegmentationAnalyzer.cs rename to arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/SegmentationAnalyzer.cs index 5f5040c5..f4b8c9f1 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/SegmentationAnalyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/SegmentationAnalyzer.cs @@ -1,11 +1,11 @@ using System; -namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerDefinitionProperties { /// /// Properties for Segmentation analyzer /// - public class SegmentationAnalyzer : AnalyzerPropertiesBase + public class SegmentationAnalyzer : AnalyzerDefinitionPropertiesBase { /// /// Convert to all lower-case characters diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/StemAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/StemAnalyzer.cs similarity index 74% rename from arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/StemAnalyzer.cs rename to arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/StemAnalyzer.cs index 76c1102f..42698a43 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/StemAnalyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/StemAnalyzer.cs @@ -1,11 +1,11 @@ using System; -namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerDefinitionProperties { /// /// Properties for Stem analyzer /// - public class StemAnalyzer : AnalyzerPropertiesBase + public class StemAnalyzer : AnalyzerDefinitionPropertiesBase { /// /// A locale in the format language, e.g. "de" or "en". diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/StopwordsAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/StopwordsAnalyzer.cs similarity index 83% rename from arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/StopwordsAnalyzer.cs rename to arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/StopwordsAnalyzer.cs index 54e105b8..fb634a3c 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/StopwordsAnalyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/StopwordsAnalyzer.cs @@ -1,12 +1,12 @@ using System; using System.Collections.Generic; -namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerDefinitionProperties { /// /// Properties for Stopwords analyzer /// - public class StopwordsAnalyzer : AnalyzerPropertiesBase + public class StopwordsAnalyzer : AnalyzerDefinitionPropertiesBase { /// /// A list of strings that describe the tokens to be discarded. diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzer.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/TextAnalyzer.cs similarity index 96% rename from arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzer.cs rename to arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/TextAnalyzer.cs index 230e205a..80e31304 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzer.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerDefinitionProperties/TextAnalyzer.cs @@ -1,12 +1,12 @@ using System; using System.Collections.Generic; -namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerDefinitionProperties { /// /// Properties for text analyzer /// - public class TextAnalyzer:AnalyzerPropertiesBase + public class TextAnalyzer:AnalyzerDefinitionPropertiesBase { /// /// Convert to all lower-case characters diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties.cs b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties.cs new file mode 100644 index 00000000..856d0764 --- /dev/null +++ b/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties.cs @@ -0,0 +1,372 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ArangoDBNetStandard.AnalyzerApi.Models +{ + /// + /// All analyzer properties + /// + public class AnalyzerProperties + { + /// + /// One byte is considered as one character (default) + /// + public const string StreamTypeBinary = "binary"; + + /// + /// One Unicode codepoint is treated as one character + /// + public const string StreamTypeUTF8 = "utf8"; + + /// + /// Optional. When true, accented characters are preserved. + /// When false, accented characters are converted to + /// their base characters. + /// + public bool? Accent { get; set; } + + /// + /// A locale in the format language[_COUNTRY][.encoding][@variant] + /// (square brackets denote optional parts), e.g. "de.utf-8" or + /// "en_US.utf-8". Only UTF-8 encoding is meaningful in ArangoDB. + /// The locale is forwarded to ICU without checks. An invalid + /// locale does not prevent the creation of the Analyzer. + /// + public string Locale { get; set; } + + /// + /// Determines how to handle character casing + /// Possible values are , + /// , and + /// + public string Case { get; set; } + + /// + /// An Analyzer is capable of removing + /// specified tokens from the input. + /// It uses binary comparison to + /// determine if an input token should + /// be discarded. It checks for exact + /// matches. If the input contains only + /// a substring that matches one of the + /// defined stopwords, then it is not discarded. + /// Longer inputs such as prefixes of + /// stopwords are also not discarded. + /// + public List StopWords { get; set; } + + /// + /// Turn Stemming ON or OFF. + /// If true, the analyzer stems the text, + /// treated as a single token, for supported languages. + /// Stemming support is provided by Snowball, + /// which supports the languages listed at: + /// 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. + /// 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; } + + /// + /// Unsigned integer for the minimum n-gram length + /// + public int? Min { get; set; } + + /// + /// Unsigned integer for the maximum n-gram length + /// + public int? Max { get; set; } + + /// + /// When true: include the original value as well. + /// When false: produce the n-grams based on + /// and only. + /// + public bool? PreserveOriginal { get; set; } + + /// + /// This value will be prepended to n-grams which + /// include the beginning of the input. Can be used + /// for matching prefixes. Choose a character or + /// sequence as marker which does not occur in the input. + /// + public string StartMarker { get; set; } + + /// + /// This value will be appended to n-grams which + /// include the end of the input. Can be used for + /// matching suffixes. Choose a character or sequence + /// as marker which does not occur in the input. + /// + public string EndMarker { get; set; } + + /// + /// Type of the input stream. + /// Possible values are + /// and + /// + public string StreamType { get; set; } + + /// + /// Convert emitted tokens to strings. (default) + /// + public const string ReturnTypeString = "string"; + + /// + /// Convert emitted tokens to numbers + /// + public const string ReturnTypeNumber = "number"; + + /// + /// Convert emitted tokens to booleans + /// + public const string ReturnTypeBool = "bool"; + + /// + /// AQL query to be executed + /// + public string QueryString { get; set; } + + /// + /// When true: set the position to 0 for all members + /// of the query result array. + /// When false: (default): set the position corresponding + /// to the index of the result array member + /// + public bool? CollapsePositions { get; set; } + + /// + /// When true: (default): treat null like an empty string. + /// When false: discard nulls from View index. Can be used + /// for index filtering (i.e. make your query return null + /// for unwanted data). Note that empty results are always + /// discarded. + /// + public bool? KeepNull { get; set; } + + /// + /// A number between 1 and 1000 (default = 1) that determines + /// the batch size for reading data from the query. In general, + /// a single token is expected to be returned. However, if the + /// query is expected to return many results, then increasing + /// trades memory for performance. + /// + public int? BatchSize { get; set; } + + /// + /// Memory limit for query execution in bytes. + /// (default is 1048576 = 1Mb) + /// Maximum is 33554432U (32Mb) + /// + public int? MemoryLimit { get; set; } + + /// + /// The Data type of the returned tokens. If the indicated + /// type does not match the actual type then an implicit + /// type conversion is applied. For possible values, see + /// , + /// and + /// + public string ReturnType { get; set; } + + /// + /// The delimiting character(s) + /// + public string Delimiter { get; set; } + + /// + /// Index all GeoJSON geometry types (Point, Polygon etc.) + /// (default). + /// + public const string TypeShape = "shape"; + + /// + /// Compute and only index the centroid of the input + /// geometry + /// + public const string TypeCentroid = "centroid"; + + /// + /// Only index GeoJSON objects of type Point, ignore all + /// other geometry types + /// + public const string TypePoint = "point"; + + /// + /// Determines the type of indexing to use. + /// Possible values are , + /// and + /// + public string Type { get; set; } + + /// + /// Options for fine-tuning geo queries. + /// These options should generally remain unchanged. + /// + public GeoJSONAnalyzerOptions Options { get; set; } + + /// + /// A list of strings that describes the attribute path + /// of the latitude value relative to the field for + /// which the Analyzer is defined in the View. + /// + public List Latitude { get; set; } + + /// + /// A list of strings that describes the attribute path + /// of the longitude value relative to the field for + /// which the Analyzer is defined in the View. + /// + public List Longitude { get; set; } + + /// + /// Convert to all lower-case characters + /// + public const string CaseHandlingLower = "lower"; + + /// + /// Convert to all upper-case characters + /// + public const string CaseHandlingUpper = "upper"; + + /// + /// Do not change character case (default) + /// + public const string CaseHandlingNone = "none"; + + /// + /// An array of Analyzer objects to use for the pipeline. + /// Analyzers of types geopoint and geojson cannot be used + /// in pipelines and will make the creation fail. + /// These Analyzers require additional postprocessing and + /// can only be applied to document fields directly. + /// + public List Pipeline { get; set; } + + /// + /// Return all tokens + /// + public const string BreakTypeAll = "all"; + + /// + /// Return tokens composed of alphanumeric characters only (default). + /// + public const string BreakTypeAlpha = "alpha"; + + /// + /// Return tokens composed of non-whitespace characters only. + /// Note that the list of whitespace characters does not include line breaks: + /// U+0009 Character Tabulation, U+0020 Space, U+0085 Next Line, + /// U+00A0 No-break Space, U+1680 Ogham Space Mark, U+2000 En Quad, + /// U+2028 Line Separator, U+202F Narrow No-break Space, + /// U+205F Medium Mathematical Space, and U+3000 Ideographic Space. + /// + public const string BreakTypeGraphic = "graphic"; + + /// + /// Determines how to break up the input text. + /// Possible values are , , + /// and + /// + public string Break { get; set; } + + /// + /// A list of strings that describe the tokens to be discarded. + /// The interpretation of each string depends on the value of + /// the property. + /// + public List Stopwords { get; set; } + + /// + /// If false (default), then each string in + /// is used verbatim. If true, then the strings need to be hex-encoded. + /// This allows for removing tokens that contain non-printable characters. + /// + public bool? Hex { get; set; } + + /// + /// If present, then edge n-grams are generated for + /// each token (word). That is, the start of the + /// n-gram is anchored to the beginning of the token, + /// whereas the ngram Analyzer would produce all possible + /// substrings from a single input token (within the + /// defined length restrictions). Edge n-grams can be + /// used to cover word-based auto-completion queries + /// with an index, for which you should set the following + /// other options: = false, + /// = + /// and most importantly = false. + /// + public TextAnalyzerEdgeNgram EdgeNgram { get; set; } + + /// + /// A path with a language sub-directory (e.g. en for a locale en_US) + /// containing files with words to omit. Each word has to be on a + /// separate line. Everything after the first whitespace character + /// on a line will be ignored and can be used for comments. The files + /// can be named arbitrarily and have any file extension (or none). + /// Default: if no path is provided then the value of the environment + /// variable IRESEARCH_TEXT_STOPWORD_PATH is used to determine the path, + /// or if it is undefined then the current working directory is assumed. + /// If the stopwords attribute is provided then no stop-words are loaded + /// from files, unless an explicit is also provided. + /// Note that if the can not be accessed, + /// is missing language sub-directories or has no files for a language + /// required by an Analyzer, then the creation of a new Analyzer + /// is refused. If such an issue is discovered for an existing Analyzer + /// during startup then the server will abort with a fatal error. + /// + public string StopwordsPath { get; set; } + } +} diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzerOptions.cs b/arangodb-net-standard/AnalyzerApi/Models/GeoJSONAnalyzerOptions.cs similarity index 83% rename from arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzerOptions.cs rename to arangodb-net-standard/AnalyzerApi/Models/GeoJSONAnalyzerOptions.cs index 86466a0f..4de3d70d 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/GeoJSONAnalyzerOptions.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/GeoJSONAnalyzerOptions.cs @@ -1,11 +1,11 @@ using System; -namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +namespace ArangoDBNetStandard.AnalyzerApi.Models { /// /// Options for fine-tuning geo queries. /// - public class GeoJSONAnalyzerOptions + public class GeoJSONAnalyzerOptions { /// /// Maximum number of S2 cells (default: 20) diff --git a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzerEdgeNgram.cs b/arangodb-net-standard/AnalyzerApi/Models/TextAnalyzerEdgeNgram.cs similarity index 84% rename from arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzerEdgeNgram.cs rename to arangodb-net-standard/AnalyzerApi/Models/TextAnalyzerEdgeNgram.cs index c958de21..da199086 100644 --- a/arangodb-net-standard/AnalyzerApi/Models/AnalyzerProperties/TextAnalyzerEdgeNgram.cs +++ b/arangodb-net-standard/AnalyzerApi/Models/TextAnalyzerEdgeNgram.cs @@ -1,11 +1,11 @@ using System; -namespace ArangoDBNetStandard.AnalyzerApi.Models.AnalyzerProperties +namespace ArangoDBNetStandard.AnalyzerApi.Models { /// /// /// - public class TextAnalyzerEdgeNgram + public class TextAnalyzerEdgeNgram { /// /// Minimal n-gram length