在 SQL Server 上逐字使用 SOUNDEX() [英] Use SOUNDEX() word by word on SQL Server

查看:24
本文介绍了在 SQL Server 上逐字使用 SOUNDEX()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的问题.例如,我有一个表 Products,其中包含一个字段 Name:

Here is my problem. For example I have a table Products that contains a field, Name:

Products
ID | Name | ..
1  | "USB Key 10Go"
2  | "Intel computer"
3  | "12 inches laptop computer"
...

我目前正在为 iPhone 网络应用程序实现一个简单的搜索引擎(SQL Server 和 ASP .NET、C#),我想使用 SOUNDEX() SQL Server 函数.

I'm currently implementing a simple search engine (SQL Server and ASP .NET, C#) for an iPhone web-app and I would like to use the SOUNDEX() SQL Server function.

问题是,我不能在 Name 字段上直接使用 SOUNDEX.(这无关紧要,因为名称中有多个单词.)我想将 SOUNDEX 函数应用于 Name 字段中的每个单词,然后查看是否有其中,与研究的关键字相匹配.

The thing is, I can't directly use SOUNDEX on the Name field. (This would be irrelevant since there are several words in the name.) I would like to apply the SOUNDEX function to each word from the Name field, and then see if any of them matches the researched keyword.

如果有人知道如何做到这一点,那就太棒了.

If someone has any clue how to do this, that would be awesome.

推荐答案

您是否研究过 SQL Server 中的全文搜索功能?我知道这不是你所要求的.只是 SOUNDEX() 函数用于查找相似的 SOUNDING 名称(例如:SMITH 和 SMYTHE 听起来相同).然而,在搜索引擎中,一个词的发音不如搜索词本身重要.全文搜索还允许您使用同义词(允许您指定在应用程序上下文中具有相同含义的某些词),并在您的搜索过程中自动考虑它们.

Have you looked into the Full-Text Search feature in SQL Server? I know this is not exactly what you asked for. Its just that the SOUNDEX() function is used to find similar SOUNDING names (EX: SMITH and SMYTHE sound the same). In a search engine, however, how a word sounds is less important than the search words themselves. Full-Text Search also lets you use synonyms (allowing you to specify certain words that mean the same thing within your application's context), and have them automatically considered during your search.

查看这些页面以了解有关 SQL Server 中全文搜索的更多信息:

Look at these pages for more information about Full Text Search in SQL Server:

全文搜索简介

CONTAINS

CONTAINSTABLE

FREETEXT

FREETEXTTABLE

这篇关于在 SQL Server 上逐字使用 SOUNDEX()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆