닷넷누크 검색엔진은 한글을 고려하지 않고 만든 엔진이다. 그러므로 조사가 명사에 붙어 있는 우리말 같은 굴절어는 제대로 처리를 하지 못한다. 정식 한글 엔진을 넣으면 좋지만 응급처방으로 검색 쿼리를 간단히 수정하여 대부분의 문제를 해결할 수 있다. 다음과 같이 GetSearchResults 저장 프로시저를 수정한다.
CREATE procedure dbo.GetSearchResults
@PortalID int,
@Word nVarChar(100)
AS
SELECT si.SearchItemID,
sw.Word,
siw.Occurrences,
siw.Occurrences + 1000 as Relevance,
m.ModuleID,
tm.TabID,
si.Title,
si.Description,
si.Author,
si.PubDate,
si.SearchKey,
si.Guid,
si.ImageFileId,
u.FirstName + ' ' + u.LastName As AuthorName,
m.PortalId
FROM SearchWord sw
INNER JOIN SearchItemWord siw ON sw.SearchWordsID = siw.SearchWordsID
INNER JOIN SearchItem si ON siw.SearchItemID = si.SearchItemID
INNER JOIN Modules m ON si.ModuleId = m.ModuleID
LEFT OUTER JOIN TabModules tm ON si.ModuleId = tm.ModuleID
INNER JOIN Tabs t ON tm.TabID = t.TabID
LEFT OUTER JOIN Users u ON si.Author = u.UserID
WHERE (((m.StartDate Is Null) OR (GetDate() > m.StartDate)) AND ((m.EndDate Is Null) OR (GetDate() < m.EndDate)))
AND (((t.StartDate Is Null) OR (GetDate() > t.StartDate)) AND ((t.EndDate Is Null) OR (GetDate() < t.EndDate)))
AND (sw.Word like @Word+'%')
AND (t.IsDeleted = 0)
AND (m.IsDeleted = 0)
AND (t.PortalID = @PortalID)
ORDER BY Relevance DESC
GO
굵게 표시된 부분이 수정된 부분이다. 원래는
AND (sw.Word = @Word)
라고 되어 있다. 이렇게 수정하는 이유는 위에서 설명한 바와 같이 명사뒤에 붙은 조사들을 무시하고 모두 다 찾기 위해서이다.