2012年3月27日星期二

Full text search?

I seem to have a problem with how Full-text search works in SQL Server 2000.
Here is an example, I have the following two "Notes" field values in two
different records:
Notes for record 1: 'hello this is a test'
Notes for record 2: 'hello again'
--
When I use this select statement:
select notes from DOCUMENTS_CATALOGPRODUCTS b where notes like
'%hello%'
it returns both records.
--
When I use this select statement with CONTAIN keyword:
select notes from DOCUMENTS_CATALOGPRODUCTS b where contains
(b.*, 'hello')
it returns only 1 record, the first one.
---
When I try to add the wildcard in the selection as follows:
select notes from DOCUMENTS_CATALOGPRODUCTS b where contains
(b.*, '*hello*')
it also returns only 1 record, the first one.
---
Therefore, this seems to be a problem with how CONTAINS keyword
works. We have to keep the 'CONTAINS' keyword because that it is
how Full-Text search works in SQL. Is this correct?The first thing I would do is to rebuild the full text indexes... They are
not (generally) kept up to date with inserts, etc... so the ft indexes could
be behind...
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Dean J Garrett" <info@.amuletc.com> wrote in message
news:Ohr$qDXMFHA.1308@.tk2msftngp13.phx.gbl...
>I seem to have a problem with how Full-text search works in SQL Server
>2000.
> Here is an example, I have the following two "Notes" field values in two
> different records:
> Notes for record 1: 'hello this is a test'
> Notes for record 2: 'hello again'
> --
> When I use this select statement:
> select notes from DOCUMENTS_CATALOGPRODUCTS b where notes like
> '%hello%'
> it returns both records.
> --
> When I use this select statement with CONTAIN keyword:
> select notes from DOCUMENTS_CATALOGPRODUCTS b where contains
> (b.*, 'hello')
> it returns only 1 record, the first one.
> ---
> When I try to add the wildcard in the selection as follows:
> select notes from DOCUMENTS_CATALOGPRODUCTS b where contains
> (b.*, '*hello*')
> it also returns only 1 record, the first one.
> ---
> Therefore, this seems to be a problem with how CONTAINS keyword
> works. We have to keep the 'CONTAINS' keyword because that it is
> how Full-Text search works in SQL. Is this correct?
>

没有评论:

发表评论