Query XML Search Field Weights implementation adjustment
Query XML Search Field Weights implementation adjustment
Problem
Within various Query XML examples included within 1.3 builds 1 and 2, the query definition (for fulltext queries) doesn't use the correct implementation for applying the (default) physical/contenttype-specific field weights.
Physical field weights can be set using the action (Physical) Field Weights within the Faceted Search Console. When for a particular field a weight has been set (which can be overruled on Contenttype-level using Contenttype-specific field weights), this means the field will be included within the Search Group's view as separate column.
However, the weight-value 1 has a special meaning. Setting weight-value 1 makes the field available as separate column, which can then be used within a facet query without the need for an additional join construction.
But since every (physical) field is already included within the QueryData field, setting a weight-value of 1 shouldn't influence the search result ranks. That's why the Query XML should use this.fieldweight(...) > 1.
Second problem is that field weights are applied directly with their underlying value, whereas the value should have been decreased by one since every field is already included within QueryData which counts as one.
Resolution
The example below shows the correct query definition, which is part of the Publication Query XML (source=content).
SQL | 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 - 1)")} 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")} {sys.iif(!this.isbasequery() AND this.mode()==SearchQuery, "WHERE " + this.fieldweight("",default="c."+this.fieldname()+"_weight") + ">1")} ]]> </query> |
This query definition includes the following two changes:
- The default for the (first) this.fieldweight() viper has been changed and now uses -1 to apply the correct field weight.
- An additional sys.iif() viper has been added at the end which adds a WHERE statement to exclude results for which the field weight equals 1.
- Features
-
Add-On Modules
- SmartInstant
- Electronic front office "E-loket"
- Enforcing Cookie Policies
-
Faceted Search
- Requirements and deploying Faceted Search
- Introducing Faceted Search
- Using Faceted Search
- Faceted Search concepts
- Customizing your Faceted Search
- Reference
-
Knowledge Base
- Existing SearchGroups or LinkedDataSearchGroups CTFPs will be removed
- Upgrading alpha version Faceted Search
- How to customize result highlighting in Faceted Search
- Run stored procedure pr_tsFacetedSearch after adding/changing physical field weights
- Skin CSS gets mangled after saving
- Faceted Search Full-text vs Native
- Implementing exact matching of search term(s) for native queries
- Dutch breaker / stemmer issue for SQL Server 2012 (SOLVED)
- Slides knowledge session (October 2010)
- Smartsite Management Information (SMI)
- Search Engine Optimization (SEO) Toolkit
- Web Toolkit
- Personalization
- DigiD Module
- Ogone Payment Module
- Emergency redirect