gpt-3.5-turbo-0613· openai
Suzhen/CodeChat
请使用NEST 7.17.5库来更新旧版本(NEST 1.4.3)的C#代码: public class SparePartEntity { private string…
- User
请使用NEST 7.17.5库来更新旧版本(NEST 1.4.3)的C#代码: public class SparePartEntity { private string _name;
public SparePartEntity() { RepkitEntities = new List<RepKitEntity>(); GroupNames = new List<string>(); AllGroupNames = new List<string>(); Attributes = new List<AttributeEntity>(); ImageNames = new List<string>(); RepkitPartNames = new List<string>(); AllAssemblyGroupNames = new List<string>(); FollowUpIds = new List<string>(); Synonyms = new List<string>(); ElevatorManufacturerNames = new List<string>(); ElevatorManufacturerNames = new List<string>(); PartsManufacturerNames = new List<string>(); ProductLineNames = new List<string>(); ComponentTypeNames = new List<string>(); AssemblyGroupNames = new List<string>(); Downloads = new List<string>(); AllAssemblyGroupNamesLocalized = new List<string>(); AllGroupNamesLocalized = new List<string>(); ProductLineIds = new List<int>(); AssemblyGroupElevatorIds = new List<int>(); AssemblyGroupEscalatorIds = new List<int>(); ComponentTypeIds = new List<int>(); PartsManufacturerIds = new List<int>(); GroupIds = new List<int>(); MainAttributeIds = new List<int>(); SpecificAttributeIds = new List<int>(); } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public string Id { get; set; } [ElasticProperty(Index = FieldIndexOption.Analyzed, AddSortField = true)] public string Name { get { return _name; } set { _name = value; NamePrefix = value != null ? value.ToLower() : null; } } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public string NamePrefix { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public string SparePartId { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public string Kg { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public string OwnerKg { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public string Symbol { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed, IncludeInAll = true)] public string Barcode { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public string LanguageKey { get; set; } [ElasticProperty(Index = FieldIndexOption.Analyzed)] public string Description { get; set; } public string Dimensions { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public double Length { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public double Width { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public double Height { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public string Weight { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public DateTime Timestamp { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public DateTime? MarkedDeletedTimestamp { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public DateTime CreateDate { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public DateTime LastSynced { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public long SparePartRevision { get; set; } public bool IsDeleted { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public List<string> ElevatorManufacturerNames { get; set; } #region Product Line [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public List<int> ProductLineIds { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public List<string> ProductLineNames { get; set; } [ElasticProperty(Index = FieldIndexOption.Analyzed)] public List<string> ProductLineNamesAnalyzed { get; set; } #endregion #region Assembly Group Elevator [ElasticProperty(Index = FieldIndexOption.NotAnalyzed, IncludeInAll = true)] public List<int> AssemblyGroupElevatorIds { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed, IncludeInAll = true)] public List<int> AssemblyGroupEscalatorIds { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed, IncludeInAll = true)] public List<string> AssemblyGroupNames { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public List<string> AllAssemblyGroupNames { get; set; } [ElasticProperty(Index = FieldIndexOption.Analyzed)] public List<string> AllAssemblyGroupNamesAnalyzed { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public List<string> AllAssemblyGroupNamesLocalized { get; set; } #endregion #region Assembly Group Escalator #endregion #region Component Type [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public List<int> ComponentTypeIds { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public List<string> ComponentTypeNames { get; set; } [ElasticProperty(Index = FieldIndexOption.Analyzed)] public List<string> ComponentTypeNamesAnalyzed { get; set; } #endregion #region Part Manufacturer [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public List<int> PartsManufacturerIds { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public List<string> PartsManufacturerNames { get; set; } [ElasticProperty(Index = FieldIndexOption.Analyzed)] public List<string> PartsManufacturerNamesAnalyzed { get; set; } #endregion #region Spare Part Group [ElasticProperty(Index = FieldIndexOption.NotAnalyzed, AddSortField = true)] public string GroupName { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed, AddSortField = true)] public List<int> GroupIds { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed, AddSortField = true)] public List<string> GroupNames { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public List<string> AllGroupNames { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public List<string> AllGroupNamesLocalized { get; set; } [ElasticProperty(Index = FieldIndexOption.Analyzed)] public List<string> AllGroupNamesAnalyzed { get; set; } #endregion #region RepKit [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public bool IsRepkit { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed, IncludeInAll = true)] public List<string> RepkitPartNames { get; set; } [ElasticProperty()] public List<RepKitEntity> RepkitEntities { get; set; } #endregion [ElasticProperty(Index = FieldIndexOption.Analyzed)] public List<AttributeEntity> Attributes { get; set; } public List<string> Synonyms { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed, IncludeInAll = true)] public List<string> FollowUpIds { get; set; } public List<string> ImageNames { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public List<string> Downloads { get; set; } [ElasticProperty(Index = FieldIndexOption.Analyzed)] public string Oem { get; set; } [ElasticProperty(Index = FieldIndexOption.Analyzed)] public List<string> AllDescriptions { get; set; } [ElasticProperty(Index = FieldIndexOption.Analyzed)] public List<string> AllNames { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public List<int> MainAttributeIds { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public List<int> SpecificAttributeIds { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public bool? PredefinedSolutions { get; set; } public byte[] ImageHash { get; set; } [ElasticProperty(Index = FieldIndexOption.NotAnalyzed)] public BomEntity Bom { get; set; } } - Assistant
- User
请使用NEST 7.17.5库来更新旧版本(NEST 1.4.3)的C#代码: private QueryContainerDescriptor ApplyFilters(SearchRequest request, QueryContainerDescriptor fqd) { return fqd.Filter(fd => { var filters = new List(); var dimensionFilter = AddDimensions(request, fd); if (dimensionFilter != null) filters.Add(dimensionFilter); AddKgAndLanguage(request, filters, fd); AddPredefinedSolutions(request, filters, fd);
- Assistant
使用NEST 7.17.5库更新后的代码如下:
private QueryContainerDescriptor<SparePartEntity> ApplyFilters(SearchRequest request, QueryContainerDescriptor<SparePartEntity> fqd) { return fqd.Query(q => q.Bool(b => { var filters = new List<QueryContainer>(); var dimensionFilter = AddDimensions(request); if (dimensionFilter != null) filters.Add(dimensionFilter); AddKgAndLanguage(request, filters); AddPredefinedSolutions(request, filters); foreach (var value in Enum.GetValues(typeof(FilterType)).Cast<FilterType>()) { if (value == FilterType.Attribute) { filters.Add(request.Filters.Where(f