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]
GO

CREATE FULLTEXT CATALOG pageStoreCat
GO

CREATE FULLTEXT INDEX ON dbo.pageStore
(
 StoreName LANGUAGE English,
 OwnerOccupation LANGUAGE English
)
KEY INDEX PK_pageStore ON pageStoreCat
WITH CHANGE_TRACKING AUTO
GO

INSERT 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‘)
GO

WAITFOR 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_TBL
ON 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

时间: 2024-07-30 22:51:00

Full Text Search 实现Sort的实现方案的相关文章

Ruby操作MongoDB(进阶十)--文本搜索text search

MongoDB数据库对于文本内容之上搜索查询操作上提供了文本索引,文本索引可以应用于所有的字符串或者字符数组的字段.为了在Ruby驱动上使用文本搜索,首先使用indexes.create_one()方法创建一个文本索引.下面的实例中,在test数据库中的restaurants集合后果,为name字段创建了一个文本索引. client=Mongo::Client.new(['127.0.0.1:27017'],:database=>'test') client[:restaurants].inde

Javascript > Eclipse > problems encountered during text search

Reproduce: Ctrl + H, Select "File Search", will encounter eclipse kinds of bug/error alert: problems encountered during text search Reason: It's because Ctrl + H by default will search disk files, and when the disk files get un-sync with eclipse

FULL TEXT SEARCH

1. During data access through Information Access Service, Fuzzy Search queries are routed to the search engine, while linguistic processing is handled by the text proccessor. 2. For data type TEXT and SHORTTEXT,  the index creation is done during tab

Using text search in Web page with Sikuli

在網頁中如何使用Sikuli找特定字串呢? 原理: 我們可以使用 組合鍵 ctrl + 來放大網頁的比例,使得sikuli的OCR功能找的更清準 實作: for i in range(4): type("+", KEY_CTRL) which = input() # Let user type the string which user want. print Region(344,178,124,501).hover(which) mouseMove(Env.getMouseLoca

Entity Framework 中使用SQL Server全文索引(Full Text Search)

GitHub:https://github.com/fissoft/Fissoft.EntityFramework.Fts EntityFramework中原来使用全文索引有些麻烦,需要使用DbContext.Database.SqlQuery或Execute去直接执行SQL.那样不能靠编译来检查读法错误,重构也不方便. 不过EF6增加Interceptor,可以执行前置和后置操作. Eg: public class FtsInterceptor : IDbCommandInterceptor

linux常用命令-文本处理cut,sort,uniq,wc,tr

cut:截取文本特定字段 NAME       cut - remove sections from each line of files -d, --delimiter=DELIM(指定字段分隔符,默认是空格) use DELIM instead of TAB for field delimiter -f, --fields=LIST(指定要显示的字段) select  only  these  fields;  also print any line that contains no del

Postgres full-text search is Good Enough!

When you have to build a web application, you are often asked to add search. The magnifying glass is something that we now add to wireframes without even knowing what we are going to search. Search has became an important feature and we've seen a big

关于Lucene的自定义Sort排序

参考:http://blog.csdn.net/wxwzy738/article/details/8585786 使用Sort排序工具实现排序 Lucene在查询的时候,可以通过以一个Sort作为参数构造一个检索器IndexSearcher,在构造Sort的时候,指定排序规则. 调用sort进行排序的方法是IndexSearcher.search,例如: IndexSearcher.search(query,sort); 关于Sort类,在其内部定义了6种构造方法: public Sort()

杂记a---DataTable.DefaultView.ToTable,.Sort,.RowFilter;DataTable.Copy()

string sql = ""; sql = string.Format( "select {0} from pkg_info {1} {2}", columns, Convert.GetSearchSql(searchParams, ref parameters), Convert.GetOrderBySql(orderParams)); 等同于 string sql; sql = "select " + columns + " fr