Search for a string that occurs either in title, tags or body Posts need a minimum score of 7 and should be without code in body
Q&A about the site for members of the workforce navigating the professional setting
-- Top score question to given tags/keywords/min score -- -- without code examples -- DECLARE @Tag1 VARCHAR(30) = ##FirstTagOrKeyword:string##; SET @Tag1 = '%' + LTRIM(RTRIM(@Tag1)) + '%'; DECLARE @Tag2 VARCHAR(30) = ##SecondTagOrKeyword:string##; SET @Tag2 = '%' + LTRIM(RTRIM(@Tag2)) + '%'; -- Search Tags and Keywords in Header DECLARE @MinScore int = ##MinimumScore## -- min Score SELECT Id AS [Post Link], Score, Tags, Body FROM Posts q WHERE PostTypeId = 1 AND ((q.Tags LIKE @Tag1 AND q.Tags LIKE @Tag2) OR (q.Title LIKE @Tag1 AND q.Title LIKE @Tag2)) AND (q.Body NOT LIKE '%pre%') -- No <pre> allowed, most Code Block starts with <pre><code> --Other Options --AND (q.Body NOT LIKE '<pre><code>%</code></pre>') --AND (q.Body NOT LIKE '%code%') --AND (q.Body NOT LIKE '%<blockcode%') --AND (q.Body NOT LIKE '%<ul%') --AND (q.Body NOT LIKE '%<ol%') --AND (q.Body NOT LIKE '%<img%')' AND q.Score >= @MinScore ORDER BY Score DESC