继续用NEST 7.17.5的库，用c#语言替换以下代码
        public SearchDescriptor<SparePartEntity> GetFullDescriptor(SearchRequest request)
        {
            var sd = new SearchDescriptor<SparePartEntity>().Skip(request.Skip).Take(request.Take);

            var searchText = string.IsNullOrWhiteSpace(request.DynamicText) ? "*" : request.DynamicText.ToLower();
            var escapedText = EscapeText(searchText);
            var fuzzySearchText = escapedText;

            var userInputs = searchText.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            if (userInputs.Count() > 1)
            {
                fuzzySearchText = string.Join("~ AND ", userInputs) + "~";
            }
            else
            {
                fuzzySearchText += "~";
            }

            //sd = sd.Query(qd => qd
            //    .Bool(bqd => bqd)


            sd = sd.Query(qd => qd.Filtered(fqd => ApplyFilters(request, fqd)
                                                   .Query(qdi =>
                                                   {
                                                       var q = qdi.Prefix(s => s.SparePartId, escapedText, 40) ||
                                                              qdi.Prefix(s => s.Oem, escapedText, 39) ||
                                                              qdi.Prefix(s => s.NamePrefix, escapedText, 3) ||
                                                              qdi.QueryString(mmqd => mmqd.Query(fuzzySearchText).OnFields(new[] { "_all" })) ||
                                                              qdi.QueryString(mmqd => mmqd.Query("\"" + escapedText + "\"").OnFields(new[] { "_all" }).Boost(3)) ||
                                                              qdi.QueryString(qsd =>
                                                              {
                                                                  qsd.FuzzyMinimumSimilarity(0.7).FuzzyPrefixLength(0)
                                                                     .Query(fuzzySearchText)
                                                                     .OnFieldsWithBoost(fd => fd.Add(s => s.SparePartId, 5)
                                                                                                .Add(s => s.Oem, 5)
                                                                                                .Add(s => s.Name, 2)
                                                                                                .Add(s => s.ProductLineNamesAnalyzed, 2)
                                                                                                .Add(s => s.Bom, 6));
                                                              });

                                                       //var boosts = new int[] { 20, 6, 4 };
                                                       //var index = 0;

                                                       //foreach (var str in userInputs.Take(3))
                                                       //{
                                                       //    q = q || qdi.Wildcard(s => s.Name, str, boosts[index++]);
                                                       //}

                                                       return q;
                                                   })));

            if (request.OrderbyFilter != null)
            {
                //sd = sd.SortDescending(s => s.IsRepkit);
                sd = sd.Sort(s =>
                {
                    var order = request.OrderbyFilter.Direction == OrderDirection.Ascending
                      ? SortOrder.Ascending
                      : SortOrder.Descending;
                    s = s.Order(order);
                    switch (request.OrderbyFilter.Field)
                    {
                        case SortField.Relevance:
                            s = s.OnField("_score");
                            break;
                        case SortField.IdNumber:
                            s = s.OnField(sp => sp.SparePartId);
                            break;
                        case SortField.Name:
                            s = s.OnField("name.sort");
                            break;
                        //case SortField.PartsGroup:
                        //    s = s.OnField("groupNames.sort");
                        //    break;
                        case SortField.AssemblyGroup:
                            s = s.OnField("assemblyGroupNames");
                            s = s.Mode(SortMode.Min);
                            break;
                        default:
                            throw new ArgumentOutOfRangeException();
                    }
                    return s;
                });

                if (request.OrderbyFilter.Field == SortField.AssemblyGroup)
                {
                    sd = sd.Sort(s =>
                    {
                        var order = request.OrderbyFilter.Direction == OrderDirection.Ascending
                          ? SortOrder.Ascending
                          : SortOrder.Descending;
                        s = s.Order(order);
                        s = s.OnField(sp => sp.SparePartId);
                        return s;
                    });
                }
            }
            return sd;
        }

        private SearchDescriptor<MetadataEntity> GetFilterDescriptor(FilterType filterType, int facetTake, string text, string kgId, string languageKey)
        {
            var sd = new SearchDescriptor<MetadataEntity>().Skip(0).Take(facetTake).Query(
              fd => fd.Term(m => m.LanguageKey, languageKey) && fd.Term(m => m.Kg, kgId));

            return sd.Query(
                  fd => fd.Term(s => s.FilterType, filterType)
                  &&
                  (
                  fd.QueryString(qd => qd.Query(EscapeText(text) + "~").OnFields(m => m.Name).FuzzyMinimumSimilarity(0.8)) ||
                  fd.QueryString(qd => qd.Query(MultiWordWildcard(text)).OnFields(m => m.Name).Boost(2))
                  ));
        }