Create a dynamic SQL query that has the following format: If there are one or more mandatory words (+ prefix) in the query: SELECT fkPageID, sum(k1.Rank + k2.Rank + ...) as Rank FROM tblPage p INNER JOIN usrPageKeywordViewWithRanks k1 ON k1.pkid=pkid AND k1.Keyword LIKE @Keyword1 INNER JOIN usrPageKeywordViewWithRanks k2 ON k2.pkid=pkid AND k2.Keyword LIKE @Keyword2 ... more joins GROUP BY pkid ORDER BY Rank DESC If there are no mandatory words, but one or more optional words (no +/- prefix): SELECT fkPageID, sum(Rank) as Rank FROM usrPageKeywordViewWithRanks p WHERE (Keyword LIKE @Keyword1+'%' OR Keyword LIKE @Keyword2+'%' OR ...) If there are one or more exclude words (- prefix), add the following to the WHERE clause: AND ("AND" only inserted if there are previous WHERE statements) fkPageID NOT IN (SELECT * FROM usrPageKeywordView p WHERE Keyword LIKE @Keyword3+'%' OR Keyword LIKE @Keyword4+'%' OR ...)

Namespace:  EPiServer.Core.Html
Assembly:  EPiServer (in EPiServer.dll) Version: 5.2.375.236

Syntax

C#
public static DynamicSQLQuery BuildDynamicSearchQuery(
	TextSearchParameters searchParams
)

Parameters

searchParams
Type: EPiServer.Core.Html..::.TextSearchParameters
An instantiated TextSearchParameters object that contains the search words

Return Value

A string containing the SQL query

See Also