0

I'm a fresh man in SQL Server Fulltext Index service. Now I have a PostBody table with 3 columns

(PostID bigint, PostBody nvarchar(max),CreatedDate datetime2(7)).

I'm using the Table varible function ContainsTable to get the top 100 ranked results. But I also need to add one more feature CreatedDate that will be make the results more reasonable. The latest and matched results should be shown.

select top 100 p.*,rp.Rank from PostBody p, ContainsTable(PostBody,Body,'mvc',100) as rp
where p.PostID=rp.Key
order by rp.Rank desc 

But How will be CreatedDate take into consider?

I will be very appreciate for your help. Regards,

David

Incognito
  • 2,964
  • 2
  • 27
  • 40
DavidPeng
  • 53
  • 7
  • `CreatedDate` is already in your results. You select `p.*` which means all columns from PostBody. Your result set will have columns: PostID, PostBody, CreatedDate, Rank – Keith Mar 03 '14 at 20:56
  • Thank you buddy. I do not only want to get the Post's CreatedDate. There are many recent posts ranked at a low level. So I want to make the recent posts rank higher. – DavidPeng Mar 04 '14 at 05:47
  • 1
    SQL Server does not natively support weighing full text results by another column (CreatedDate in your case). You'll need to calculate your own weight and factor it into the Rank. – Keith Mar 04 '14 at 14:55

0 Answers0