Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Other Technologies / Full-Text Search / November 2004

Tip: Looking for answers? Try searching our database.

Determine words found??

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RGM - 22 Nov 2004 18:59 GMT
I am searching a text fields, I have every setup already and I am able to do
CONTAINSTABLE and FREETEXT... When I use weight the numbers dont make any
sense.  I really would like to be able to specify a value for the my keywords
and also determine what words were found when I run the query.  Right now I
run a CONTAINSTABLE query for each of the words so that I can determine what
words were found and then give the record a RANK.  Can some please help me
out here, this process is causing alot of work on the server. Thank you,
Hilary Cotter - 23 Nov 2004 01:39 GMT
Regrettably your approach while very expensive is probably the best
approach.

>I am searching a text fields, I have every setup already and I am able to
>do
[quoted text clipped - 7 lines]
> words were found and then give the record a RANK.  Can some please help me
> out here, this process is causing alot of work on the server. Thank you,
John Kane - 23 Nov 2004 05:34 GMT
RGM,
Could you post the full output of -- SELECT @@version -- as well as an
example of your SQL FTS query and a row count (count(*)) from your FT enable
table? All of this is necessary information that is helpful in
troubleshooting SQL FTS issues.

If I understand you correctly, you want to "influence" the RANK value return
from CONTAINSTABLE or FREETEXTTABLE and you need a list of keywords to do
this? In order to get meaningful RANK values, it is necessary to have
"statistically significant" number of rows in your FT-enable table, at least
10,000 rows. See the last paragraph in SQL Server 2000 BOL title "Full-text
Search Recommendations" for more info.

Thanks,
John

> I am searching a text fields, I have every setup already and I am able to do
> CONTAINSTABLE and FREETEXT... When I use weight the numbers dont make any
[quoted text clipped - 3 lines]
> words were found and then give the record a RANK.  Can some please help me
> out here, this process is causing alot of work on the server. Thank you,
RGM - 23 Nov 2004 18:49 GMT
Microsoft SQL Server  2000 - 8.00.760 (Intel X86)   Dec 17 2002 14:22:05  
Copyright (c) 1988-2003 Microsoft Corporation  Developer Edition on Windows
NT 5.0 (Build 2195: Service Pack 4)

Create FUNCTION FN_STATEMENT(@Value varchar(300))
returns varchar(350)
as
begin
    declare @Statement varchar(350)
        select @value = replace(@value,' of ',' ')
        select @value = replace(@value,' and ',' ')
        if patindex('% %' , @value) > 0
        begin
            select @Statement = '( ' + replace(ltrim(rtrim(replace(@value,'"',''))),'
',' near ') + ')'
            select @value = replace(ltrim(rtrim(replace(@value,'"',''))) ,' ','%')   
        end
        else
        begin
            select @Statement = ' FORMSOF (INFLECTIONAL,'+ @value +') '
            select @value = replace(@value,' ','%')
        end
    return @Statement
end

/************section with stored proc**********/
select @MaxKWItmId = Max(ItmId) from @KeyWords
    if @MaxKWItmId > 0
    BEGIN
        Select top 1 @KWItmId = ItmId, @Statement = dbo.FN_STATEMENT(Value) ,
@WordsFound = @WordsFound + ' ' + Value , @Search = Value , @SearchRank = Rank
            From @KeyWords
        while (@KWItmId < @MaxKWItmId)
        BEGIN
            select @KWItmId = @KWItmId + 1
            Select  @Statement =@Statement  + ' and ' + dbo.FN_STATEMENT(Value),
@WordsFound = @WordsFound + ' ' + Value,@SearchRank = @SearchRank  + Rank
                From @KeyWords
                    Where ItmId = @KWItmId
        END
        Insert into @Table(UrlId , Search , SearchRank, Position , WordsFound )
        select UrlId , rtrim(ltrim(@WordsFound)), @SearchRank , Patindex('%' +
replace(replace(@Search,'"',''),' ','%') + '%',Content) -
80,rtrim(ltrim(@WordsFound))
        FROM     {oj ULARL AS C
                INNER JOIN
                CONTAINSTABLE(ULARL,CONTENT, @Statement) AS K
                ON C.UrlId = K.[KEY]}
        where datediff(day , C.DateCreate,getdate()) in (select DO.DateCreate from
@DaysOldTable DO)
         and C.IsArticle in (select ST.IsArticle from @IsArticlesTable ST)

        Delete from @Keywords
        insert into @KeyWords(Value , Rank)
        select value , (case Typ when 710 then -1 else 1 end) * rank from
COCUSFEDITM Where COCUSFED_ItmId = @FedId and Inactive = 0 and IsRequired = 0
Order by Rank Desc
        select @MaxKWItmId = Max(ItmId), @KWItmId = min(ItmId) from @KeyWords
        while (@KWItmId <=@MaxKWItmId)
        BEGIN
            select @Search = Value , @SearchRank = Rank, @Statement =
dbo.FN_STATEMENT(Value) from @KeyWords where ItmId = @KWItmId
            Update T
             Set SearchRank = SearchRank + @SearchRank
               , WordsFound = WordsFound + ' ' + @Search
            FROM     {oj (ULARL AS C join @Table as T on T.UrlId = C.UrlId)
                INNER JOIN
                CONTAINSTABLE(ULARL,CONTENT, @Statement) AS K
                ON C.UrlId = K.[KEY]}
            Select @KWItmId = @KWItmId + 1
        END

    END
/************end section with stored proc**********/

I have a list of words the client is looking for.  To limit the search I
have atleast one required word.  This allows the rest of the words to search
the selecte articles rather than the other 2+ million records.
I hope this helps.
Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.