📄 cs_weblog_search_postreindex.prc
字号:
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[cs_weblog_Search_PostReindex]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[cs_weblog_Search_PostReindex]
GO
CREATE PROCEDURE [dbo].cs_weblog_Search_PostReindex
(
@RowCount int,
@SettingsID int
)
AS
SET Transaction Isolation Level Read UNCOMMITTED
SET ROWCOUNT @RowCount
SELECT
P.PostID, P.ParentID, P.FormattedBody, P.Body, P.SectionID, P.PostDate, P.PostLevel,P.Subject, P.SortOrder,
T.ThreadDate, T.ThreadID, P.IsApproved, P.IsLocked, P.TotalViews, P.AggViews, P.IPAddress, P.PostType, P.EmoticonID,
P.PropertyNames as PostPropertyNames, P.PropertyValues as PostPropertyValues, null as EditNotes, 0 as NextThreadID, 0 as PrevThreadID,
P.PostConfiguration,
B.*, U.*, T.RatingSum, T.TotalRatings,
T.IsLocked,
T.IsSticky,
Username = P.PostAuthor, P.UserID,
EditNotes = null, -- (SELECT EditNotes FROM cs_PostEditNotes WHERE PostID = P.PostID),
AttachmentFilename = null, -- ISNULL ( (SELECT [FileName] FROM cs_PostAttachments WHERE PostID = P.PostID), ''),
Replies = T.TotalReplies, -- (SELECT COUNT(P2.PostID) FROM cs_Posts P2 (nolock) WHERE P2.ParentID = P.PostID AND P2.PostLevel != 1),
IsModerator = 0, --(SELECT count(UserID) from cs_Moderators where UserID = @UserID),
HasRead = 0 -- not used
FROM
cs_Posts P (nolock),
cs_Threads T,
cs_Sections F,
cs_vw_Users_FullUser U,
cs_weblog_Posts B
WHERE
B.PostID = P.PostID AND
P.UserID = U.cs_UserID AND
F.SectionID = P.SectionID AND
F.IsActive = 1 AND
F.IsSearchable = 1 AND
P.IsApproved = 1 AND T.ThreadID = P.ThreadID AND F.IsSearchable = 1 and
P.IsIndexed = 0 and F.SettingsID = @SettingsID and U.SettingsID = @SettingsID and F.ApplicationType = 1 AND P.PostLevel = 1
ORDER BY
T.ThreadDate DESC
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
grant execute on [dbo].[cs_weblog_Search_PostReindex] to public
go
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -