Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
slacker
Posting Yak Master
115 Posts |
Posted - 2003-05-30 : 07:01:42
|
| Hey guys. I didnt get a chance to thank you for answering my last FTS question I just read your responses and it was really useful. I have yet another question :p. We are trying to create better relevancy by columnname. Basically certain columns regardless of the contents of another column should always contain the best ranking. This isnt always true when using standard contains clause. After reading some questions posted the general idea seems to be to JOIN two CONTAINSTABLE statements together and give the one with higher ranking a higher multiplier. This is really slow. A couple of other ideas floating around are... Create another table with the fields we are using in fts and the primary key. With the fields we want higher rank duplicate the contents of the orignal column like 10 times so that fts see's more words and then gives it a better ranking.. then join it with the source table.--example of what i meancreate table Movies ( MovieID INT, Title VARCHAR(100), Description VARCHAR(1000), ReleaseDate DATETIME)insert into Movies(Title,Description,ReleaseDate)values('The Matrix Reloaded','Cool movie',GETDATE())-- This table is what is actually fts'dcreate table MoviesFTS ( MovieID int, Title VARCHAR(100), Description varchar(1000))-- since we want title to have a better relevancy replace the contents-- of title over and over to force better rankinginsert into MoviesFTS(Title,Description)values('The Matrix Reloaded The Matrix Reloaded The Matrix Reloaded The Matrix Reloaded The Matrix Reloaded The Matrix Reloaded The Matrix Reloaded The Matrix Reloaded The Matrix Reloaded The Matrix Reloaded','Cool movie',GETDATE())-- select statementselect Movies.* FROM Movies INNER JOIN CONTAINSTABLE(MoviesFTS,*,'Matrix AND Reloaded') fTextON fText.[Key]=Movies.MovieIDORDER BY fText.Rank DESCOr my other idea which would be to use a CASE statementand use like on the field in question.SELECT *,CustomRank = CASEWHEN Title Like '%Matrix%Reloaded%' THEN 10000 -- force better rankElse Ftext.RankENDFROM Movies INNER JOIN CONTAINSTABLE(Movies,*,'Matrix AND Reloaded') Ftext ON Ftext.[Key]=Movies.MovieIDORDER BY CustomRank DESC |
|
|
|
|
|
|
|