Faceted Search Query Xml - SearchBase Query Element Example (Fulltext)

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 is only applicable for a fulltext indexing scenario.

 

Smartsite SXML CopyCode image Copy Code
<query><![CDATA[
    SELECT [KEY] AS Nr, (RANK {sys.iif(this.isbasequery(),
        "+" + this.seopriority("c.seopriority") +
        "+" + this.contenttypeweight("c.contenttype_weight") +
        "+" + this.popularityweight("LOG(ISNULL(pr.visits,1))/LOG(" + sys.eval(maxvisits(), smartlet.number()) + ")"))})
     * {this.fieldweight("dbo.fn_tsAgeInDays(c.moddate)", default="c."+this.fieldname()+"_weight")} AS SearchRank, 
     {sys.iif(this.isbasequery() || this.mode()!=SearchQuery, '1', 'NULL')} AS BaseSearch 
    FROM CONTAINSTABLE({this.searchgroupviewname()}, {this.fieldname(default="(QueryData,CTSpecificBinary1)")}, ?:searchterm)
    JOIN {this.searchgroupviewname()} c WITH (NOEXPAND) ON [KEY]=c.Nr
    {sys.iif(this.isbasequery(),
         "LEFT JOIN PageRequests pr ON c.Nr=pr.Nr")}
    ]]>
</query>