/// <summary> /// Adds the common fields. /// </summary> /// <param name="document">The document.</param> /// <param name="propertyBag"></param> protected virtual void AddCommonFields(Document document, PropertyBag propertyBag, ShortID runningContextId, string id) { // Here we add some useful fields: // Name - is is both used to search and to display the results // Url - is used to identify and open the file associated with the result. // Icon is used to display icon in the search results pane // Tags and Path can be used to narrow down the search but are not explicitly used in the current UI // Boost is used to adjust the priority of results from the filesystem relative to other locations. // Notice the functions used: // CreateTextField(name, value) - creates a field optimized for full-text search. // the content of the field cannot be retrieved from the index. // // CreateValueField(name, value) - creates a field optimized for value search (such as dates, GUIDs etc). // the content of the field cannot be retrieved from the index. // // CreateDataField(name, value) - creates a field that will be returned in the search result. // it is not possible to search for values in such fields. // // These functions are just helpers, and it is possible to use just Lucene.Net API here. document.Add(this.CreateValueField(BuiltinFields.Path, id)); document.Add(this.CreateDataField(BuiltinFields.Path, id)); document.Add(this.CreateTextField(BuiltinFields.Name, ValueOrEmpty(propertyBag.Title))); document.Add(this.CreateDataField(BuiltinFields.Name, ValueOrEmpty(propertyBag.Title))); document.Add(this.CreateValueField(CustomFields.UpdateContextId, runningContextId.ToString().ToLower())); document.Add(this.CreateDataField(CustomFields.Depth, value: propertyBag.Step.Depth.ToString(CultureInfo.InvariantCulture))); document.Add(this.CreateTextField(BuiltinFields.Tags, ValueOrEmpty(Tags))); document.Add(this.CreateDataField(BuiltinFields.Tags, ValueOrEmpty(Tags))); document.Add(CreateDataField(BuiltinFields.Group, ValueOrEmpty(id))); document.Boost = this.Boost; }
protected void ShowConfirm(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (!args.IsPostBack) { SheerResponse.Confirm("Personalize component settings will be removed. Are you sure you want to continue?"); args.WaitForPostBack(); return; } if (!args.HasResult || !(args.Result != "no")) { this.ComponentPersonalization.Checked = true; return; } SheerResponse.Eval("scTogglePersonalizeComponentSection()"); XElement rulesSet = this.RulesSet; foreach (XElement xElement in rulesSet.Elements("rule")) { XElement actionById = PersonalizationFormWithActions.GetActionById(xElement, this.SetRenderingActionId); if (actionById == null) { continue; } actionById.Remove(); HtmlTextWriter htmlTextWriter = new HtmlTextWriter(new StringWriter()); this.RenderSetRenderingAction(xElement, htmlTextWriter); ShortID shortID = ShortID.Parse(xElement.GetAttributeValue("uid")); Assert.IsNotNull(shortID, "ruleId"); SheerResponse.SetInnerHtml(string.Concat(shortID, "_setrendering"), htmlTextWriter.InnerWriter.ToString().Replace("{ID}", shortID.ToString())); } this.RulesSet = rulesSet; }
public static string NormalizeGuid(string guid, bool lowercase) { if (!string.IsNullOrEmpty(guid) && IsGuid(guid)) { var shortId = new ShortID(guid); return lowercase ? shortId.ToString().ToLowerInvariant() : shortId.ToString(); } return guid; }