Wrox Programmer Forums
|
BOOK: ASP.NET Website Programming Problem-Design-Solution
This is the forum to discuss the Wrox book ASP.NET Website Programming: Problem - Design - Solution, Visual Basic .NET Edition by Marco Bellinaso, Kevin Hoffman; ISBN: 9780764543869
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET Website Programming Problem-Design-Solution section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 9th, 2006, 07:57 AM
Friend of Wrox
 
Join Date: Mar 2006
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with Procedure - Search Engine for FORUMS

I made a class for the search engine, that returns me one string consonant the words that I want to search and if it is for method “OR” or “AND”.
I have two ways to solve the problem:
Or I pull one dataset entire with all the topics, or use the current system of the topics that is to pull alone dataset with the topics of a single page.

I prefer to only pull the topics of a page.

For this I liked to keep stored procedure and to only send string to make the search.

Let see :

If i wanted to search de word "blabla" i will send the string:

Code:
*** WHERE TopiRep.Message LIKE '%blabla%' OR Topi.Subject LIKE '%blabla%' ***
But this procedure should be prepared for 2... 4... 6... words

so, there is my procedure:

Code:
CREATE PROCEDURE sp_Forums_SearchWord
@myStr        varchar(500),
@PageNumber    int,
@PageSize    int

AS

CREATE TABLE #TempSearchWord
(
    ID             int IDENTITY PRIMARY KEY,
    TopicID            int,
    CategoryID        int,
    ForumID        int,
    Subject            varchar(100),
    AddedDate        datetime,
    TopicReplies        int,
    TopicLastReplyDate    datetime,
    TopicLastPostDate    datetime,
    MemberID        int,
    MemberName        varchar(15),
    LastMemberID        int,
    LastMemberName    varchar(15)
)

INSERT INTO #TempSearchWord
(
    TopicID,
    CategoryID,
    ForumID,
    Subject,
    AddedDate,
    TopicReplies,
    TopicLastReplyDate,
    TopicLastPostDate,
    MemberID,
    MemberName,
    LastMemberID,
    LastMemberName
)
SELECT 
    DISTINCT(a.TopicID),
    a.CategoryID,
    a.ForumID,
    a.Subject,
    a.AddedDate,
    a.TopicReplies,
    a.TopicLastReplyDate,
    a.TopicLastPostDate,
    a.MemberID,
    a.MemberName,
    a.LastMemberID,
    (SELECT Forums_Members.MemberName FROM Forums_Members WHERE Forums_Members.MemberID = a.LastMemberID) as LastMemberName

FROM

v_Forums_Topics a INNER JOIN (SELECT DISTINCT(TopiRep.TopicID) FROM (SELECT Forums_Topics.TopicID, Forums_Topics.Message FROM Forums_Topics UNION ALL SELECT Forums_Replies.TopicID, Forums_Replies.Message FROM Forums_Replies) TopiRep INNER JOIN Forums_Topics Topi ON Topi.TopicID = TopiRep.TopicID
@myStr   --WHERE TopiRep.Message LIKE '%blabla%' OR Topi.Subject LIKE '%blabla%'
) as Results on Results.TopicID = a.TOPICID
ORDER BY TopicLastPostDate Desc

DECLARE @FromID int
DECLARE @ToID int
SET @FromID = ((@PageNumber - 1) * @PageSize) + 1
SET @ToID = @PageNumber * @PageSize
SELECT     TopicID,
        CategoryID,
        ForumID,
        Subject, 
        AddedDate, 
        TopicReplies, 
        TopicLastReplyDate, 
        TopicLastPostDate, 
        MemberID, 
        MemberName, 
        LastMemberID,
        LastMemberName
    FROM #TempSearchWord WHERE ID >= @FromID AND ID <= @ToID
GO
Please help me to make that this procedure can receive the string of search for the some words that I to want to search.
I already tried of everything without success!
If somebody want the class that sends the string for sql i can share this with you...

Thanks,
Max, from Portugal
 
Old May 9th, 2006, 05:15 PM
Friend of Wrox
 
Join Date: Mar 2006
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am very sad with the community…

I thought that the people bought the book and would like to improve project, to become with things most functional, etc.

But I was wrong, what all people wants is to know because is that they do not obtain to install, or because why receive error X and Y?...

When I bought the book, I thought that I would go to find people for the whole world interested in improving programming.
In Portugal it is in this way that the things happens...

Good Night (or good morning)
Max

 
Old May 12th, 2006, 08:35 AM
Friend of Wrox
 
Join Date: Mar 2006
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default

solution:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=65800






Similar Threads
Thread Thread Starter Forum Replies Last Post
Search Engine snowydust Pro VB Databases 6 October 14th, 2004 03:59 AM
Search Engine for Full-text Search Kala ASP.NET 1.0 and 1.1 Professional 2 August 29th, 2004 02:16 AM
Search engine that search through local drive! wenzation Classic ASP Basics 0 August 26th, 2003 09:15 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.