Syntax
Smartsite SXML | Copy Code |
---|---|
string this.rankingstatement(string sourceName) |
Parameters
Name | Data Type | Description |
---|---|---|
sourceName | String | Name of the source. |
Return Value
Data Type | Description |
---|---|
String |
Used in
Macro | Description |
---|---|
FacetedSearchQueryBuilder | Builds an SQL query for Faceted Search. |
Remarks
The this.rankingstatement(sourcename) viper should be used within the definition of the (search) query for a source which has been configured to use native queries (that is, LIKE statements).
Based on the fieldnames listed within the wherefields element (required element for native queries!), the this.rankingstatement(sourcename) viper returns a statement which calculates the number of occurrence for each search term within each specified (physical) field, using the Faceted Search database function fn_tsCountWord(), e.g.:
SQL | Copy Code |
---|---|
(dbo.fn_tsCountWord(?:searchterm1,c.Field1)*3 + dbo.fn_tsCountWord(?:searchterm1,c.Field2)*3 + dbo.fn_tsCountWord(?:searchterm2,c.Field1)*1 + dbo.fn_tsCountWord(?:searchterm2,c.Field2)*1) |
The sourcename attribute must match with the name attribute of the enclosing source element.
Notice that the function fn_tsCountWord() is a custom function added to the database when installing Faceted Search. When you implement a Faceted Search environment to a database other then the Smartsite database itself and you want to use the this.rankingstatement() implementation, you need this function to that database manually.
Example
Faceted Search Query Xml - SearchBase Query Element Example (Native)
The Faceted Search Query Builder macro (se:facetedsearchquerybuilder) contains a lot of local instance vipers. Usually, local instance vipers are used within the macro itself, e.g. formatting, but in this case the local instance vipers should only be used within a query xml definition.
This example shows a searchbase query element from a query xml definition in which some of the available local instance vipers are used. The example here uses native queries (LIKE statements instead of CONTAINSTABLE, which is used within fulltext indexing scenarios).
Smartsite SXML | Copy Code |
---|---|
<query><![CDATA[ SELECT c.Nr, ({this.rankingstatement("content")})*100 as SearchRank, 1 AS BaseSearch FROM {this.searchgroupviewname()} c WITH (NOEXPAND) WHERE {this.searchcondition("content")} ]]> </query> |
- Macro
- Macro Parameters
- Macro Parameter Properties
-
Vipers
- Global Viper Methods
-
Local Viper Methods
- This.Add (Json) Viper Method
- This.Add (Metadata) Viper Method
- This.Add (PlaceHolder) Viper Method
- This.Add (ShoppingCart) Viper Method
- This.AddDublinCore (Metadata) Viper Method
- This.AddLine Viper Method
- This.AddNamespace (Metadata) Viper Method
- This.AddNull (Json) Viper Method
- This.AddValue (Json) Viper Method
- This.AffectedRecords (SqlQuery) Viper Method
- This.AIM.Relations Viper Method
- This.Allowemptysearch (FacetedSearchQueryBuilder20) Viper Method
- This.AltText (Image) Viper Method
- This.Amount (Payment) Viper Method
- This.Append Viper Method
- This.AppendChild (XmlProcessor) Viper Method
- This.AppendChildBinary (XmlProcessor) Viper Method
- This.AppendChildXml (XmlProcessor) Viper Method
- This.ApplyBoxFormat (SmartletBox) Viper Method
- This.Attribs (SmartletBox) Viper Method
- This.AutoTitle (Image) Viper Method
- This.BoxData (SmartletBox) Viper Method
- This.BoxMode (SmartletBox) Viper Method
- This.BoxSkin (SmartletBox) Viper Method
- This.Brand (Payment) Viper Method
- This.Break (For) Viper Method
- This.Break Viper Method
- This.Buffer.Exists Viper Method
- This.Buffer.Get Viper Method
- This.Buffer.Set Viper Method
- This.Buttons (SmartletBox) Viper Method
- This.CanGoBack (Paging) Viper Method
- This.CanGoForward (Paging) Viper Method
- This.Caption (SmartletBox) Viper Method
- This.ChildLevelResult Viper Method
- This.ClassName (Image) Viper Method
- This.Clear Viper Method
- This.ClearDublinCore (Metadata) Viper Method
- This.ClearForcedResult Viper Method
- This.ColCount Viper Method
- This.ColName Viper Method
- This.ColNumber Viper Method
- This.CompleteDocument Viper Method
- This.ContentTypeWeight (FacetedSearchQueryBuilder) Viper Method
- This.ContentTypeWeight (FacetedSearchQueryBuilder20) Viper Method
- This.Count (Paging) Viper Method
- This.Currency (Payment) Viper Method
- This.Current (Paging) Viper Method
- This.CurrentIndex (Siblings) Viper Method
- This.CustomerAddress (Payment) Viper Method
- This.CustomerCountry (Payment) Viper Method
- This.CustomerEmail (Payment) Viper Method
- This.CustomerName (Payment) Viper Method
- This.CustomerPhone (Payment) Viper Method
- This.CustomerTown (Payment) Viper Method
- This.CustomerZipcode (Payment) Viper Method
- This.Data (ViewSource) Viper Method
- This.Data Viper Method
- This.DefaultResultFormat (XLinks) Viper Method
- This.DefaultRowFormat (XLinks) Viper Method
- This.Delete (XmlProcessor) Viper Method
- This.Delete Viper Method
- This.DocTypeHeader Viper Method
- This.DocumentBody Viper Method
- This.DocumentBodyNode Viper Method
- This.EditedSmartlet (SmartletEditor) Viper Method
- This.EditorUseLocation (SmartletEditor) Viper Method
- This.Enable (CacheFile) Viper Method
- This.Error.InnerException.Message Viper Method
- This.Error.InnerException.SmartsiteCode Viper Method
- This.Error.InnerException.Throw Viper Method
- This.Error.InnerException.ToString Viper Method
- This.Error.InnerException.Type Viper Method
- This.Error.Message Viper Method
- This.Error.SmartsiteCode Viper Method
- This.Error.Throw Viper Method
- This.Error.ToString Viper Method
- This.Error.Type Viper Method
- This.Evaluate (XmlProcessor) Viper Method
- This.Exists (Json) Viper Method
- This.Expires Viper Method
- This.ExtractBinary (XmlProcessor) Viper Method
- This.ExtraData (Payment) Viper Method
- This.ExtraElements (SmartletBox) Viper Method
- This.Facet (FacetedSearchQueryBuilder) Viper Method
- This.Facet (FacetedSearchQueryBuilder20) Viper Method
- This.FacetSelectFields (FacetedSearchQueryBuilder) Viper Method
- This.FacetSelectFields (FacetedSearchQueryBuilder20) Viper Method
- This.FacetWhereClause (FacetedSearchQueryBuilder) Viper Method
- This.FacetWhereClause (FacetedSearchQueryBuilder20) Viper Method
- This.Field Viper Method
- This.Field.Exists Viper Method
- This.FieldName (FacetedSearchQueryBuilder) Viper Method
- This.FieldName (FacetedSearchQueryBuilder20) Viper Method
- This.FieldWeight (FacetedSearchQueryBuilder) Viper Method
- This.FieldWeight (FacetedSearchQueryBuilder20) Viper Method
- This.FindExact Viper Method
- This.FindExtension Viper Method
- This.FirstResult (Paging) Viper Method
- This.Footer (SmartletEditor) Viper Method
- This.ForceLayout (FlexLayout) Viper Method
- This.FormAttribs (SmartletBox) Viper Method
- This.FreetextTablesearch (FacetedSearchQueryBuilder20) Viper Method
- This.Get (Json) Viper Method
- This.GetAttribute (XmlProcessor) Viper Method
- This.GetByPosition (Json) Viper Method
- This.GetCacheKey (Cache) Viper Method
- This.getcount (Chart) Viper Method
- This.GetDocType Viper Method
- This.GetEncoded (Json) Viper Method
- This.GetEncodedValue (Json) Viper Method
- This.GetEncoding Viper Method
- This.GetForcedResult Viper Method
- This.GetInnerXml (XmlProcessor) Viper Method
- This.GetJson (Json) Viper Method
- This.GetJsonTypeName (Json) Viper Method
- This.GetJsonTypeName (Json) Viper Method
- This.GetLabel (SmartletEditor) Viper Method
- This.GetLocalNodeName (XmlProcessor) Viper Method
- This.GetMaxYValue (Chart) Viper Method
- This.GetMinYValue (Chart) Viper Method
- This.GetNameByPosition (Json) Viper Method
- This.GetNamespaceUri (XmlProcessor) Viper Method
- This.GetNodeName (XmlProcessor) Viper Method
- This.GetOmitXmlDeclaration (XHtmlPage) Viper Method
- This.GetParameter Viper Method
- This.GetPollItem (Poll) Viper Method
- This.GetPrefix (XmlProcessor) Viper Method
- This.getseriesname (Chart) Viper Method
- This.GetTotalCount (Paging) Viper Method
- This.GetTypedValue (XmlProcessor) Viper Method
- This.GetValue (Json) Viper Method
- This.GetValue (XmlProcessor) Viper Method
- This.GetValueByPosition (Json) Viper Method
- This.GetXml (XmlProcessor) Viper Method
- This.GoTo (Paging) Viper Method
- This.Group Viper Method
- This.GroupCount Viper Method
- This.GroupNumber Viper Method
- This.GroupResult Viper Method
- This.GroupRowNumber Viper Method
- This.HasUserVoted (Poll) Viper Method
- This.HeadSection Viper Method
- This.Height (SmartletBox) Viper Method
- This.Ignore (CacheFile) Viper Method
- This.ImageId (Image) Viper Method
- This.Index (For) Viper Method
- This.InfoLabel (SmartletEditor) Viper Method
- This.Initialized (Paging) Viper Method
- This.InnerClass (SmartletBox) Viper Method
- This.InsertAfter (XmlProcessor) Viper Method
- This.InsertBefore (XmlProcessor) Viper Method
- This.InsertNodeAfter (XmlProcessor) Viper Method
- This.InsertNodeBefore (XmlProcessor) Viper Method
- This.isActive (Poll) Viper Method
- This.IsBaseQuery (FacetedSearchQueryBuilder) Viper Method
- This.IsBaseQuery (FacetedSearchQueryBuilder20) Viper Method
- This.IsCached (Cache) Viper Method
- This.IsDirectory (Dir) Viper Method
- This.isMultiSelect (Poll) Viper Method
- This.ItemFormat (FeedReader) Viper Method
- This.ItemFormat (SiteMap) Viper Method
- This.JoinClause (FacetedSearchQueryBuilder) Viper Method
- This.JoinClause (FacetedSearchQueryBuilder20) Viper Method
- This.Key.Add (CacheFile) Viper Method
- This.Key.RemoveChannelDependency (CacheFile) Viper Method
- This.LastModified Viper Method
- This.LastResult (Paging) Viper Method
- This.Length (Json) Viper Method
- This.Length Viper Method
- This.Level Viper Method
- This.LevelResult Viper Method
- This.LevelRowNumber Viper Method
- This.Load (Json) Viper Method
- This.Location (Paging) Viper Method
- This.Location Viper Method
- This.MaxRows Viper Method
- This.MimeType (Json) Viper Method
- This.MimeType Viper Method
- This.Mode (FacetedSearchQueryBuilder) Viper Method
- This.Mode (FacetedSearchQueryBuilder20) Viper Method
- This.Name Viper Method
- This.Offset (Paging) Viper Method
- This.OnClick (Image) Viper Method
- This.OrderBy (FacetedSearchQueryBuilder) Viper Method
- This.OrderBy (FacetedSearchQueryBuilder20) Viper Method
- This.OrderId (Payment) Viper Method
- This.OuterClass (SmartletBox) Viper Method
- This.OuterId (SmartletBox) Viper Method
- This.OutputColorDepth (Image) Viper Method
- This.OutputCommandOrder (Image) Viper Method
- This.OutputFileSize (Image) Viper Method
- This.OutputFileType (Image) Viper Method
- This.OutputFrameCount (Image) Viper Method
- This.OutputHeight (Image) Viper Method
- This.OutputLocation (Image) Viper Method
- This.OutputResolutionUnit (Image) Viper Method
- This.OutputResolutionX (Image) Viper Method
- This.OutputResolutionY (Image) Viper Method
- This.OutputStyle (Image) Viper Method
- This.OutputWidth (Image) Viper Method
- This.param Viper Method
- This.ParameterExists Viper Method
- This.ParentLevel (Parents) Viper Method
- This.PaymentMethod (Payment) Viper Method
- This.PopularityWeight (FacetedSearchQueryBuilder) Viper Method
- This.PopularityWeight (FacetedSearchQueryBuilder20) Viper Method
- This.PopulateDatatable (XmlProcessor) Viper Method
- This.PreviewPane (SmartletEditor) Viper Method
- This.Price (ShoppingCart) Viper Method
- This.Products (ShoppingCart) Viper Method
- This.Question (Poll) Viper Method
- This.Rank (Tags) Viper Method
- This.RankingFields (FacetedSearchQueryBuilder) Viper Method
- This.RankingFields (FacetedSearchQueryBuilder20) Viper Method
- This.RankingStatement (FacetedSearchQueryBuilder20) Viper Method
- This.RawField Viper Method
- This.Redirect (Payment) Viper Method
- This.Remove (Json) Viper Method
- This.Remove (ShoppingCart) Viper Method
- This.RemoveAll (ShoppingCart) Viper Method
- This.RemoveAttribute (XmlProcessor) Viper Method
- This.RemoveNamespace (XmlProcessor) Viper Method
- This.Render (Application) Viper Method
- This.Render Viper Method
- This.Rendered Viper Method
- This.RenderedChannel (References) Viper Method
- This.RenderTime Viper Method
- This.ResponseCookies (EmbedUri) Viper Method
- This.ResponseHeaders (EmbedUri) Viper Method
- This.ResponseHeaders Viper Method
- This.ResponseTime Viper Method
- This.Result Viper Method
- This.Result Viper Method
- This.ResultChannelCode (FacetedSearchQueryBuilder) Viper Method
- This.ResultChannelCode (FacetedSearchQueryBuilder20) Viper Method
- This.ResultChannelJoins (FacetedSearchQueryBuilder) Viper Method
- This.ResultChannelJoins (FacetedSearchQueryBuilder20) Viper Method
- This.RowCount Viper Method
- This.RowNumber Viper Method
- This.RowResult Viper Method
- This.Search Viper Method
- This.SearchCondition (FacetedSearchQueryBuilder) Viper Method
- This.SearchCondition (FacetedSearchQueryBuilder20) Viper Method
- This.SearchGroupViewName (FacetedSearchQueryBuilder) Viper Method
- This.SearchGroupViewName (FacetedSearchQueryBuilder20) Viper Method
- This.SearchQuery (FacetedSearchQueryBuilder) Viper Method
- This.SearchQuery (FacetedSearchQueryBuilder20) Viper Method
- This.SelectFields (FacetedSearchQueryBuilder) Viper Method
- This.SelectFields (FacetedSearchQueryBuilder20) Viper Method
- This.SeoPriority (FacetedSearchQueryBuilder) Viper Method
- This.SeoPriority (FacetedSearchQueryBuilder20) Viper Method
- This.Serial (Payment) Viper Method
- This.Serve (CacheFile) Viper Method
- This.Set (Json) Viper Method
- This.SetAttribute (XmlProcessor) Viper Method
- This.SetCurrentPage (Paging) Viper Method
- This.SetCustomDocType Viper Method
- This.SetDocType Viper Method
- This.SetEncoding Viper Method
- This.SetForcedResult Viper Method
- This.SetInnerXml (XmlProcessor) Viper Method
- This.SetNamespace (XmlProcessor) Viper Method
- This.SetNull (Json) Viper Method
- This.SetOmitXmlDeclaration (XHtmlPage) Viper Method
- This.SetProductCount (ShoppingCart) Viper Method
- This.SetResult (XmlProcessor) Viper Method
- This.SetTotalCount (Paging) Viper Method
- This.SetValue (Json) Viper Method
- This.SetValue (XmlProcessor) Viper Method
- This.SetXmlVersion (XHtmlPage) Viper Method
- This.SiblingCount (Siblings) Viper Method
- This.SiblingExists (Siblings) Viper Method
- This.Size (Dir) Viper Method
- This.Size (Paging) Viper Method
- This.Size Viper Method
- This.Skip (Paging) Viper Method
- This.SkipRows Viper Method
- This.SmartletName (SmartletEditor) Viper Method
- This.Status (Payment) Viper Method
- This.StatusCode Viper Method
- This.Step (For) Viper Method
- This.Summary (Payment) Viper Method
- This.SXMLPath Viper Method
- This.TableOrView (FacetedSearchQueryBuilder) Viper Method
- This.TableOrView (FacetedSearchQueryBuilder20) Viper Method
- This.TaxGroups (ShoppingCart) Viper Method
- This.TaxTotals (ShoppingCart) Viper Method
- This.Title (Dir) Viper Method
- This.Title (Image) Viper Method
- This.Title (SmartletEditor) Viper Method
- This.Title Viper Method
- This.ToDisplay (ShoppingCart) Viper Method
- This.ToString (ShoppingCart) Viper Method
- This.Totals (ShoppingCart) Viper Method
- This.TotalVotes (Poll) Viper Method
- This.ToXml (ShoppingCart) Viper Method
- This.UseBox (SmartletBox) Viper Method
- This.Value (Switch) Viper Method
- This.VisibleRowCount Viper Method
- This.VisibleRowNumber Viper Method
- This.Vote (Poll) Viper Method
- This.WhereClause (FacetedSearchQueryBuilder) Viper Method
- This.WhereClause (FacetedSearchQueryBuilder20) Viper Method
- This.Width (SmartletBox) Viper Method
- This.Xml (XmlProcessor) Viper Method
- This.XmlDeclaration (XHtmlPage) Viper Method
- This.XValue (Chart) Viper Method
- This.YValue (Chart) Viper Method
- SXML Data Types
- Examples
- Tips & Tricks