首页 > 代码库 > Full Text Search 实现Sort的实现方案
Full Text Search 实现Sort的实现方案
CREATE TABLE dbo.pageStore( ID int NOT NULL, StoreName varchar(50) NULL, OwnerOccupation varchar(50) NULL, CONSTRAINT PK_pageStore PRIMARY KEY CLUSTERED ( [ID] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]GOCREATE FULLTEXT CATALOG pageStoreCatGOCREATE FULLTEXT INDEX ON dbo.pageStore( StoreName LANGUAGE English, OwnerOccupation LANGUAGE English)KEY INDEX PK_pageStore ON pageStoreCatWITH CHANGE_TRACKING AUTOGOINSERT INTO pageStore VALUES (393,‘Naroon House‘,‘Ali Haririan‘)INSERT INTO pageStore VALUES (394,‘Andishe Vila‘,‘Ali Zarein‘)INSERT INTO pageStore VALUES (395,‘Naroon‘,‘John Sample‘)GOWAITFOR DELAY ‘00:00:05‘SELECT ID,StoreName,OwnerOccupation,KEY_TBL.[KEY],KEY_TBL.[RANK] FROM pageStore INNER JOIN CONTAINSTABLE(pageStore,(StoreName,OwnerOccupation), N‘ISABOUT( "Ali" WEIGHT (0.2) ,"Naroon" WEIGHT (0.3),"House" WEIGHT (0.1))‘) AS KEY_TBLON pageStore.ID = KEY_TBL.[KEY] ORDER BY [RANK] DESC
The result is:
ID | StoreName | OwnerOccupation | KEY | RANK |
393 | Naroon House | Ali Haririan | 393 | 111 |
395 | Naroon | John Sample | 395 | 73 |
394 | Andishe Vila | Ali Zarein | 394 | 47 |
Full Text Search 实现Sort的实现方案
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。