My query should have been this in order to only include published items:
tagCounts = from tc in _contentTagRepository.Table
where
tc.TagsPartRecord.ContentItemRecord.Versions.Where(v => v.Published).Any()
group tc by tc.TagRecord.TagName into g
select new TagCount {
TagName = g.Key,
Count = g.Count()
};
-----Original Message-----
From: Bertrand Le Roy [mailto:[email protected]]
Sent: Thursday, January 27, 2011 10:49 PM
To: [email protected]
Subject: RE: Searching Tagged Content in Admin
You might want to take a look at the HomeController in the Tags module, too.
-----Original Message-----
From: Bertrand Le Roy [mailto:[email protected]]
Sent: Thursday, January 27, 2011 10:07 PM
To: [email protected]
Subject: RE: Searching Tagged Content in Admin
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [157.54.123.12]
Content-Type: multipart/alternative;
boundary="_000_0DD703E66360DB42A5085498EC59141B01672265TK5EX14MBXC118r_"
MIME-Version: 1.0
Return-Path: [email protected]
--_000_0DD703E66360DB42A5085498EC59141B01672265TK5EX14MBXC118r_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Ignore that request, that's not good.
From: Bertrand Le Roy
Sent: Thursday, January 27, 2011 10:03 PM
To: [email protected]
Subject: RE: Searching Tagged Content in Admin
Here's what I'm doing to get the list of tags with counts (directly through=
the repo):
tagCounts =3D from tc in _contentTagRepository.Table
group tc by tc.TagRecord.TagName into g
select new TagCount {
TagName =3D g.Key,
Count =3D g.Count()
};
But for your specific question, I suppose you could get a reference to ITag=
Service and use tagService.GetTaggedContentItems(tagService.GetTagByName("f=
oo").Id)
Let me know how that works for you.
From: Bertrand Le Roy [mailto:[email protected]]<mailto:[mailto=
:[email protected]]>
Sent: Thursday, January 27, 2011 5:13 PM
To: [email protected]<mailto:[email protected]=
curve.org>
Subject: RE: Searching Tagged Content in Admin
Sure.
From: Chris Bower [mailto:[email protected]]<mailto:[mailto:digital11@gma=
il.com]>
Sent: Thursday, January 27, 2011 5:11 PM
To: [email protected]<mailto:[email protected]=
curve.org>
Subject: Re: Searching Tagged Content in Admin
Thanks Bertrand!
Any chance that once you get a query written you could send it along as an =
example even before the widget is ready for release?
From: Bertrand Le Roy <[email protected]<mailto:Bertrand.Le.Roy=
@microsoft.com>>
Reply-To: <[email protected]<mailto:orchard-discuss@list=
s.outercurve.org>>
Date: Fri, 28 Jan 2011 01:08:03 +0000
To: <[email protected]<mailto:[email protected]=
rcurve.org>>
Subject: RE: Searching Tagged Content in Admin
Weird, I'm doing a tag cloud widget right now. It's operating on the front-=
end but queries should be pretty much the same. I'll let you know when it's=
ready.
From: Chris Bower [mailto:[email protected]]
Sent: Thursday, January 27, 2011 5:01 PM
To: [email protected]<mailto:[email protected]=
curve.org>
Subject: Searching Tagged Content in Admin
How would one go about querying for a specific content type that has a spec=
ific tag? I can't figure out how to construct the query using an IContentQu=
ery.
---
You are currently subscribed to orchard-discuss as: bertrand.le.roy@microso=
ft.com<mailto:[email protected]>.
To unsubscribe send a blank email to [email protected]=
.org<mailto:[email protected]>.
---
You are currently subscribed to orchard-discuss as: [email protected]<mai=
lto:[email protected]>.
To unsubscribe send a blank email to [email protected]=
.org<mailto:[email protected]>.
---
You are currently subscribed to orchard-discuss as: bertrand.le.roy@microso=
ft.com<mailto:[email protected]>.
To unsubscribe send a blank email to [email protected]=
.org<mailto:[email protected]>.
---
You are currently subscribed to orchard-discuss as: bertrand.le.roy@microso=
ft.com<mailto:[email protected]>.
To unsubscribe send a blank email to [email protected]=
.org<mailto:[email protected]>.
--_000_0DD703E66360DB42A5085498EC59141B01672265TK5EX14MBXC118r_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40"> <head> <meta http-equiv=3D"Content-Type"
content=3D"text/html; charset=3Dus-ascii"=
>
<meta name=3D"Generator" content=3D"Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";} a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";}
span.EmailStyle19
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.EmailStyle20
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.EmailStyle21
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.EmailStyle22
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" /> </xml><![endif]--><!--[if
gte mso 9]><xml> <o:shapelayout v:ext=3D"edit"> <o:idmap v:ext=3D"edit"
data=3D"1" /> </o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"EN-US" link=3D"blue" vlink=3D"purple"> <div
class=3D"WordSection1"> <p class=3D"MsoNormal"><span
style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D">Ignore that request, that=
’s not good.<o:p></o:p></span></p> <p class=3D"MsoNormal"><span
style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D"><o:p> </o:p></span><=
/p>
<div>
<div style=3D"border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm =
0cm 0cm"> <p class=3D"MsoNormal"><b><span
style=3D"font-size:10.0pt;font-family:"=
;Tahoma","sans-serif"">From:</span></b><span style=3D"font-s=
ize:10.0pt;font-family:"Tahoma","sans-serif""> Bertrand=
Le Roy <br> <b>Sent:</b> Thursday, January 27, 2011 10:03 PM<br> <b>To:</b>
[email protected]<br>
<b>Subject:</b> RE: Searching Tagged Content in Admin<o:p></o:p></span></p>
</div> </div> <p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D">Here’s what I’= ;m
doing to get the list of tags with counts (directly through the repo):<o=
:p></o:p></span></p> <p class=3D"MsoNormal" style=3D"text-autospace:none"><span
style=3D"font-fa=
mily:Consolas"> =
tagCounts =3D
<span style=3D"color:blue">from</span> tc <span style=3D"color:blue">in</sp=
an> _contentTagRepository.Table<o:p></o:p></span></p>
<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-fa=
mily:Consolas">  =
; &n=
bsp;<span style=3D"color:blue">group</span> tc <span
style=3D"color:blue">by</span> tc.TagRecord.TagName <span style=3D"co=
lor:blue"> into</span> g<o:p></o:p></span></p> <p class=3D"MsoNormal"
style=3D"text-autospace:none"><span style=3D"font-fa=
mily:Consolas"> =
&nb=
sp;
<span style=3D"color:blue">select</span> <span style=3D"color:blue">new</sp=
an> <span style=3D"color:#2B91AF">
TagCount</span> {<o:p></o:p></span></p>
<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-fa=
mily:Consolas"> =
&nb=
sp; TagName =3D g.Key,<o:p></o:p></span></p> <p
class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-fa=
mily:Consolas"> =
&nb=
sp; Count =3D g.Count()<o:p></o:p></span></p> <p
class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-fa=
mily:Consolas"> =
&nb=
sp; };<o:p></o:p></span></p>
<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-fa=
mily:Consolas"><o:p> </o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D"><o:p> </o:p></span><=
/p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D">But for your specific que=
stion, I suppose you could get a reference to ITagService and use tagServic=
e.GetTaggedContentItems(tagService.GetTagByName(“foo”).Id)<o:p>=
</o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D"><o:p> </o:p></span><=
/p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D">Let me know how that work= s
for you.<o:p></o:p></span></p> <p class=3D"MsoNormal"><span
style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D"><o:p> </o:p></span><=
/p>
<div>
<div style=3D"border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm =
0cm 0cm"> <p class=3D"MsoNormal"><b><span
style=3D"font-size:10.0pt;font-family:"=
;Tahoma","sans-serif"">From:</span></b><span style=3D"font-s=
ize:10.0pt;font-family:"Tahoma","sans-serif""> Bertrand=
Le Roy <a
href=3D"mailto:[mailto:[email protected]]">[mailto:Bertrand.=
[email protected]]</a>
<br>
<b>Sent:</b> Thursday, January 27, 2011 5:13 PM<br> <b>To:</b> <a
href=3D"mailto:[email protected]">orchard-=
[email protected]</a><br>
<b>Subject:</b> RE: Searching Tagged Content in Admin<o:p></o:p></span></p>
</div> </div> <p class=3D"MsoNormal"><o:p> </o:p></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D">Sure.<o:p></o:p></span></=
p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D"><o:p> </o:p></span><=
/p>
<div>
<div style=3D"border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm =
0cm 0cm"> <p class=3D"MsoNormal"><b><span
style=3D"font-size:10.0pt;font-family:"=
;Tahoma","sans-serif"">From:</span></b><span style=3D"font-s=
ize:10.0pt;font-family:"Tahoma","sans-serif""> Chris Bo=
wer <a href=3D"mailto:[mailto:[email protected]]">[mailto:[email protected]=
]</a> <br>
<b>Sent:</b> Thursday, January 27, 2011 5:11 PM<br> <b>To:</b> <a
href=3D"mailto:[email protected]">orchard-=
[email protected]</a><br>
<b>Subject:</b> Re: Searching Tagged Content in Admin<o:p></o:p></span></p>
</div> </div> <p class=3D"MsoNormal"><o:p> </o:p></p>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:10.5pt;font-family:"Ca=
libri","sans-serif";color:black">Thanks Bertrand!<o:p></o:p>=
</span></p> </div> <div> <p class=3D"MsoNormal"><span
style=3D"font-size:10.5pt;font-family:"Ca=
libri","sans-serif";color:black"><o:p> </o:p></span></p=
>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:10.5pt;font-family:"Ca=
libri","sans-serif";color:black">Any chance that once you ge= t
a query written you could send it along as an example even before the wid= get
is ready for release? <o:p></o:p></span></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:10.5pt;font-family:"Ca=
libri","sans-serif";color:black"><o:p> </o:p></span></p=
>
</div>
<div style=3D"border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm =
0cm 0cm"> <p class=3D"MsoNormal"><b><span
style=3D"font-size:11.0pt;font-family:"=
;Calibri","sans-serif";color:black">From:
</span></b><span style=3D"font-size:11.0pt;font-family:"Calibri",=
"sans-serif";color:black">Bertrand Le Roy <<a href=3D"mailto:B=
[email protected]">[email protected]</a>><br>
<b>Reply-To: </b><<a href=3D"mailto:[email protected]=
">[email protected]</a>><br>
<b>Date: </b>Fri, 28 Jan 2011 01:08:03 +0000<br>
<b>To: </b><<a href=3D"mailto:[email protected]">orch=
[email protected]</a>><br>
<b>Subject: </b>RE: Searching Tagged Content in Admin<o:p></o:p></span></p>
</div> <div> <p class=3D"MsoNormal"><span
style=3D"font-size:10.5pt;font-family:"Ca=
libri","sans-serif";color:black"><o:p> </o:p></span></p=
>
</div>
<div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D">Weird, I’m doing a =
tag cloud widget right now. It’s operating on the front-end but queri= es
should be pretty much the same. I’ll let you know when it’s =
ready.</span><span style=3D"color:black"><o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D"> </span><span style=
=3D"color:black"><o:p></o:p></span></p>
<div>
<div style=3D"border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm =
0cm 0cm"> <p class=3D"MsoNormal"><b><span
style=3D"font-size:10.0pt;font-family:"=
;Tahoma","sans-serif";color:black">From:</span></b><span sty=
le=3D"font-size:10.0pt;font-family:"Tahoma","sans-serif"=
;;color:black"> Chris Bower [<a href=3D"mailto:[email protected]">mailto:=
[email protected]</a>]
<br>
<b>Sent:</b> Thursday, January 27, 2011 5:01 PM<br> <b>To:</b> <a
href=3D"mailto:[email protected]">orchard-=
[email protected]</a><br>
<b>Subject:</b> Searching Tagged Content in Admin</span><span style=3D"colo=
r:black"><o:p></o:p></span></p> </div> </div> <p class=3D"MsoNormal"><span
style=3D"color:black"> <o:p></o:p></span>=
</p>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:10.5pt;font-family:"Ca=
libri","sans-serif";color:black">How would one go about quer=
ying for a specific content type that has a specific tag? I can't figure ou= t
how to construct the query using an IContentQuery. </span><span styl=
e=3D"color:black"><o:p></o:p></span></p>
</div>
<p class=3D"MsoNormal"><span style=3D"font-size:10.5pt;font-family:"Ca=
libri","sans-serif";color:black">---
<br>
You are currently subscribed to orchard-discuss as: <a href=3D"mailto:bertr=
[email protected]"> [email protected]</a>. <br> To
unsubscribe send a blank email to <a href=3D"mailto:leave-orchard-discus=
[email protected]">
[email protected]</a>. </span><span style=3D"color=
:black"><o:p></o:p></span></p> <p class=3D"MsoNormal"><span
style=3D"font-size:10.5pt;font-family:"Ca=
libri","sans-serif";color:black">---
<br>
You are currently subscribed to orchard-discuss as: <a href=3D"mailto:digit=
[email protected]"> [email protected]</a>. <br> To unsubscribe send a blank
email to <a href=3D"mailto:leave-orchard-discus=
[email protected]">
[email protected]</a>. <o:p></o:p></span></p> </div>
</div> <p class=3D"MsoNormal"><span
style=3D"font-size:10.5pt;font-family:"Ca=
libri","sans-serif";color:black">---
<br>
You are currently subscribed to orchard-discuss as: <a href=3D"mailto:bertr=
[email protected]"> [email protected]</a>. <br> To
unsubscribe send a blank email to <a href=3D"mailto:leave-orchard-discus=
[email protected]">
[email protected]</a>. <o:p></o:p></span></p> <p
class=3D"MsoNormal">--- <br> You are currently subscribed to orchard-discuss
as: <a href=3D"mailto:bertr= [email protected]">
[email protected]</a>. <br> To unsubscribe send a blank email to <a
href=3D"mailto:leave-orchard-discus=
[email protected]">
[email protected]</a>. <o:p></o:p></p> </div>
---
<BR>
You are currently subscribed to orchard-discuss as:
[email protected].
<BR>
To unsubscribe send a blank email to [email protected].
---
<BR>
You are currently subscribed to orchard-discuss as:
[email protected].
<BR>
To unsubscribe send a blank email to [email protected].
---
<BR>
You are currently subscribed to orchard-discuss as: [email protected].
<BR>
To unsubscribe send a blank email to [email protected].
</BODY>
</html>
--_000_0DD703E66360DB42A5085498EC59141B01672265TK5EX14MBXC118r_--