我要进行查询检索人近语法。当我搜索第二个单词中包含字母N的任何文本时,结果始终为空。
我有两个人在桌子上注册了里卡多,分别是“里卡多·莫瓦”和“里卡多·诺瓦”。如果搜索“里卡多NEAR‘MOVA *’”这是确定的,而不是“里卡多NEAR‘新星*’
编辑
表格:
CREATE TABLE [dbo].[EntitySearch](
[IdEntity] [int] NOT NULL,
[Name] [nvarchar](max) NULL,
[Accessibility] [bit] NOT NULL,
[Document] [nvarchar](max) NULL,
[Email] [nvarchar](max) NULL,
[Phone] [nvarchar](max) NULL,
[Phone2] [nvarchar](max) NULL,
[Birthdate] [datetime] NULL,
[Gender] [int] NULL,
[IsAct] [bit] NOT NULL,
[Discriminator] [int] NOT NULL,
CONSTRAINT [PK_dbo.EntitySearch] PRIMARY KEY CLUSTERED
(
[IdEntity] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
目录
CREATE FULLTEXT CATALOG main_catalog;
展开索引
CREATE FULLTEXT INDEX ON dbo.EntitySearch
( [Name]
Language[Brazilian],
[Document]
Language[Brazilian],
[Email]
Language[Brazilian],
[Phone]
Language[Brazilian],
[Phone2]
Language[Brazilian] )
KEY INDEX [PK_dbo.EntitySearch] ON main_catalog;
查询:
SELECT top 10
FT_TBL.[IdEntity]
,FT_TBL.[Name]
,FT_TBL.[Accessibility]
,FT_TBL.[Document]
,FT_TBL.[Email]
,FT_TBL.[Phone]
,FT_TBL.[Phone2]
,FT_TBL.[Birthdate]
,FT_TBL.[Gender]
,FT_TBL.[IsAct]
,FT_TBL.[Discriminator]
FROM [EntitySearch] AS FT_TBL INNER JOIN
CONTAINSTABLE ([EntitySearch], [Name], 'Ricardo NEAR "Nova*"' ) AS KEY_TBL
ON FT_TBL.[IdEntity] = KEY_TBL.[KEY]
WHERE
FT_TBL.[IsAct] = 1
and FT_TBL.[Discriminator] = 2
and KEY_TBL.RANK > 10
ORDER BY KEY_TBL.RANK DESC, FT_TBL.[Name]
我希望显示1条记录,但没有显示。谢谢!
编辑:替代方法
我放弃了,并使用葡萄牙语将其改写为全文索引。问题已经解决了,所以我猜“ bug”是在巴西语言上作为索引。
答案 0 :(得分:0)
这不是错误。
每种语言都有您自己的自停单词列表,这意味着某些单词与索引搜索无关。
SELECT *
FROM sys.fulltext_system_stopwords
WHERE language_id = 1046 --Brazilian language ID
因此,以我为例,我做了一种算法,可以在发送之前更正搜索查询。