Smartsite Documentatie
>
Features & Modules
>
Add-On Modules
>
Faceted Search
>
Knowledge Base
> Implementing exact matching of search term(s) for native queries
Implementing exact matching of search term(s) for native queries
Implementing exact matching of search term(s) for native queries
Problem
Faceted Search (at least at this moment) always uses LIKE statements for native search queries. When you want exact matching of search term(s) within the search query for a source definition with type=native, this can not be achieved by setting some parameter.
Resolution
Since the Query XML fully supports vipers, you can achieve exact matching simply by just adding some vipers to the query definition:
Smartsite SXML | Copy Code |
---|---|
{string.replace(this.searchcondition(sourcename), 'like\s+(\?:searchterm\d+)', "= REPLACE($1,'%','')",UseRegExpCaseInsensitive)} |
The viper above replaces the "LIKE ?:searchtermx" statement with "= REPLACE(?:searchtermx, '%',''). The searchtermx SQL parameter for native queries is usually enclosed with '%'-characters, so these needs to be removed for exact matching.
Within the Query XML, this will look something like:
XML | Copy Code |
---|---|
<source name="content" displayname="Content" enabled="true"> <searchbases> <searchbase name="classic" type="native"> <searchprofiles> <searchprofile name="titlesonly">c.title</searchprofile> </searchprofiles> <weights default="1" agefactor="0.05" seopriority="0" /> <query><![CDATA[ SELECT c.Nr, ({this.rankingstatement("content")})*100 (+ other weights) AS SearchRank, 1 AS BaseSearch FROM {this.searchgroupviewname()} c WITH (NOEXPAND) WHERE {string.replace(this.searchcondition(content), 'like\s+(\?:searchterm\d+)', "= REPLACE($1,'%','')",UseRegExpCaseInsensitive)} ]]> </query> <wherefields>c.title,c.description,c.querydata</wherefields> </searchbase> </searchbases> </source> |
- 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
- Query XML Search Field Weights implementation adjustment
- 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