StackExchange / NRediSearch

Other
30 stars 9 forks source link

Sortable tagfields #redisearch #6

Open kishoretvk opened 4 years ago

kishoretvk commented 4 years ago

HI Team, Thanks for the effort you guys put in, that helps everyone. wanted to get this added to Nredisearch : it is present in Jredisearch as well here is the id from jredissearch repo https://github.com/RediSearch/JRediSearch/commit/751c644d3b0c2c79bcfde11f73fd71ec559674c4

can we get this added in NRedisearch as well ? we can't query sort on tagfields, Redissearch allows us to do it , hope we can get it enabled for NRedissearch too

kishoretvk commented 4 years ago

we had this for sortable text in https://github.com/StackExchange/StackExchange.Redis/blob/master/src/NRediSearch/Schema.cs

     /// <summary>
        /// Add a text field that can be sorted on.
        /// </summary>
        /// <param name="name">The field's name.</param>
        /// <param name="weight">Its weight, a positive floating point number.</param>
        /// <returns>The <see cref="Schema"/> object.</returns>
        public Schema AddSortableTextField(string name, double weight = 1.0)
        {
            Fields.Add(new TextField(name, weight, true));
            return this;
        }`

similarly, we a property like so would also help

     /// <summary>
        /// Add a text field that can be sorted on.
        /// </summary>
        /// <param name="name">The field's name.</param>
        /// <param name="weight">Its weight, a positive floating point number.</param>
        /// <returns>The <see cref="Schema"/> object.</returns>
        public Schema AddSortableTagField(string name, double weight = 1.0)
        {
            Fields.Add(new TagField(name, weight, true));
            return this;
        }