Code search within a tag


Please login or register to vote for this query.

(click on this box to dismiss)

based of

Craft CMS Meta

Q&A about the site for administrators, end users, developers and designers for Craft CMS

declare @search nvarchar(200) = ##code:string##
declare @tag nvarchar(35) = ##tag:string?r##

set @search = replace(@search,'[', '[[]');
set @search = replace(@search,'_', '[_]');
set @search = replace(@search,'%', '[%]');

print @search

;with tagposts as (
from posts p
inner join posttags pt on pt.postid = coalesce(p.parentid,
inner join tags t on = pt.tagid
where tagname = @tag

select  top 50
       -- count(*) as [Post Link]
     , p.posttypeid
     , p.score
     , p.creationdate
     , p.tags
from tagposts tp
inner join posts p on =
where p.body like concat('%<pre><code>%', @search, '%</code></pre>%')
order by p.score desc

Enter Parameters

Switch to main site
loading Hold tight while we fetch your results