public static SearchAttributeViewModel GetSearchAttributeViewModel(SearchAttribute searchAttribute) { SearchAttributeViewModel sa = new SearchAttributeViewModel(); sa.id = searchAttribute.id; //names sa.displayName = searchAttribute.displayName; sa.metadataNames.AddRange(searchAttribute.metadataName.Split(',')); //types sa.dataType = SearchAttribute.GetDataTypeAsDisplayString(searchAttribute.dataType); sa.searchType = SearchAttribute.GetSearchTypeAsDisplayString(searchAttribute.searchType); // parameter for index sa.store = searchAttribute.store; sa.multiValue = searchAttribute.multiValue; sa.analysed = searchAttribute.analysed; sa.norm = searchAttribute.norm; sa.boost = searchAttribute.boost; // resultview sa.headerItem = searchAttribute.headerItem; sa.defaultHeaderItem = searchAttribute.defaultHeaderItem; // properties sa.direction = SearchAttribute.GetDirectionAsString(searchAttribute.direction); sa.uiComponent = SearchAttribute.GetUIComponentAsString(searchAttribute.uiComponent); sa.aggregationType = SearchAttribute.GetAggregationTypeAsString(searchAttribute.aggregationType); //sa.dateFormat = searchAttribute.dateFormat; return(sa); }
private XmlElement SetAttributesToNode(XmlElement xmlElement, SearchAttribute sa) { // names XmlAttribute xa = this._configXML.CreateAttribute("display_name"); xa.Value = sa.displayName; xmlElement.Attributes.Append(xa); xa = this._configXML.CreateAttribute("lucene_name"); xa.Value = sa.sourceName; xmlElement.Attributes.Append(xa); xa = this._configXML.CreateAttribute("metadata_name"); xa.Value = sa.metadataName; xmlElement.Attributes.Append(xa); //types xa = this._configXML.CreateAttribute("type"); xa.Value = SearchAttribute.GetSearchTypeAsString(sa.searchType); xmlElement.Attributes.Append(xa); xa = this._configXML.CreateAttribute("primitive_type"); xa.Value = SearchAttribute.GetDataTypeAsString(sa.dataType); xmlElement.Attributes.Append(xa); // parameter for index xa = this._configXML.CreateAttribute("store"); xa.Value = SearchAttribute.GetBooleanAsString(sa.store); xmlElement.Attributes.Append(xa); xa = this._configXML.CreateAttribute("multivalued"); xa.Value = SearchAttribute.GetBooleanAsString(sa.multiValue); xmlElement.Attributes.Append(xa); xa = this._configXML.CreateAttribute("analysed"); xa.Value = SearchAttribute.GetBooleanAsString(sa.analysed); xmlElement.Attributes.Append(xa); xa = this._configXML.CreateAttribute("norm"); xa.Value = SearchAttribute.GetBooleanAsString(sa.norm); xmlElement.Attributes.Append(xa); //boost xa = this._configXML.CreateAttribute("boost"); xa.Value = sa.boost.ToString(); xmlElement.Attributes.Append(xa); // ResultView xa = this._configXML.CreateAttribute("header_item"); xa.Value = SearchAttribute.GetBooleanAsString(sa.headerItem); xmlElement.Attributes.Append(xa); xa = this._configXML.CreateAttribute("default_visible_item"); xa.Value = SearchAttribute.GetBooleanAsString(sa.defaultHeaderItem); xmlElement.Attributes.Append(xa); // properties if (sa.searchType.Equals(SearchComponentBaseType.Property)) { xa = this._configXML.CreateAttribute("direction"); xa.Value = SearchAttribute.GetDirectionAsString(sa.direction); xmlElement.Attributes.Append(xa); xa = this._configXML.CreateAttribute("uiComponent"); xa.Value = SearchAttribute.GetUIComponentAsString(sa.uiComponent); xmlElement.Attributes.Append(xa); xa = this._configXML.CreateAttribute("aggregationType"); xa.Value = SearchAttribute.GetAggregationTypeAsString(sa.aggregationType); xmlElement.Attributes.Append(xa); xa = this._configXML.CreateAttribute("date_format"); xa.Value = sa.dateFormat; xmlElement.Attributes.Append(xa); } return(xmlElement); }