Groups | Blog | Home
all groups > sql server full text search > january 2004 >

sql server full text search : "weight" failing in fulltext search in Sql-Server EE


gmandavia NO[at]SPAM smartbrief.com
1/21/2004 7:13:38 AM
Hi,
The query pasted below

SELECT CAST(copy.copyid as VARCHAR(50)) as copyid
FROM copy,story,brief,link_copy_issue,brief_issue
WHERE CONTAINS (copy.*,' weight AND loss ')
AND brief.briefid = '96EE6D61-D70D-47B9-82C2-F1105A0A863C' AND
brief.briefid = brief_issue.briefid AND link_copy_issue.issueid =
brief_issue.issueid AND link_copy_issue.copyid = copy.copyid AND
copy.storyid = story.storyid ORDER BY CONVERT(varchar(8),
brief_issue.delivery_date, 112) desc

fails on sql-server enterprise edition with the error message:
Syntax error occurred near 'weight'. Expected '_NOT, '(', _ISABOUT,
_FORMSOF, _STRING, _PREFIX_STRING, '!'' in search condition ' weight
AND loss '.

if i run the same query on sql-server Standard edition OR replace the
word 'weight' the query works. any ideas why it would fail in the
enterprise edition and not the standard edition? also, the word
weight is not included in the noise.eng file as one of the words to be
ignored. should i just add it to that list?

any ideas would be appreciated.

thanks,
John Kane
1/21/2004 3:36:40 PM
Guru.
This is most likely a bug as the word "weight" is a keyword within the SQL
FTS predicates.
What you need to do is add double quotes around your search words, for
example using the pubs database table pub_info:

select * from pub_info where CONTAINS (*,'"weight" AND "loss"')

Also, could you post the full output of -- SELECT @@version -- as this
would be helpful in understanding this issue.
Thanks,
John



[quoted text, click to view]

gmandavia NO[at]SPAM smartbrief.com
1/22/2004 5:30:28 AM
John,
What i don't understand is why the word 'weight' fails on one
version and succeeds on the other?

the output from select @@version
Microsoft SQL Server 2000 - 8.00.534 (Intel X86) Nov 19 2001
13:23:50 Copyright (c) 1988-2000 Microsoft Corporation Standard
Edition on Windows NT 5.0 (Build 2195: Service Pack 4)
it succeeds here.

***********************
Microsoft SQL Server 2000 - 8.00.760 (Intel X86) Dec 17 2002
14:22:05 Copyright (c) 1988-2003 Microsoft Corporation Enterprise
Edition on Windows NT 5.0 (Build 2195: Service Pack 4)
it fails here.
****************

it is inconvenient to add "" around words because this is an automated
search page and a java method builds the query string. i woul have to
write custom exception to add quotes around the word weight.

thanks,
guru


[quoted text, click to view]
John Kane
1/22/2004 10:04:32 AM
Guru,
Most likely there was a fix or change in the code base between SP2 (534) and
SP3 (760) that brought to light this bug and not the differences in SQL
Server editions. Adding double quotes around not specific keywords, "weight"
in this case is just a workaround.

What you really need to do is to call Microsoft PSS SQL Server support and
open a support case and have them confirm this as a bug and if this is
critical to your business, they can generate a hotfix for you that will
truly fix this bug. If you do call PSS SQL Server support be sure to get the
bug number and let us know how & when it will be fixed!

Thanks,
John


[quoted text, click to view]

gmandavia NO[at]SPAM smartbrief.com
1/23/2004 7:12:37 AM
John,
After digging on the microsoft website for about 2 hours, here is
what I found

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_ca-co_2y2h.asp

From what I understand, M$ added new features that allow weighted,
proximity and generation term searches. For these to work, they
added WEIGHT, NEAR, ISABOUT and other terms as reserved terms.

I guess the only way to use WEIGHT is within "" which sounds more like
a bug than a feature to me. But hey, what do i know....

thanks for you help,
guru


[quoted text, click to view]
John Kane
1/23/2004 9:41:27 AM
Guru,
No, "weight" has always been a part of SQL Full-text Search CONTAINS and
ISABOUT and is not a new feature.
When I ran the below query (a simplified version of your original query), I
got the same error as you did:

select @@version -- Microsoft SQL Server 2000 - 8.00.760 (Intel X86)
select * from pub_info where CONTAINS (*,'weight AND loss')
Server: Msg 7631, Level 15, State 1, Line 2
Syntax error occurred near 'weight'. Expected '_NOT, '(', _ISABOUT,
_FORMSOF, _STRING, _PREFIX_STRING, '!''
in search condition 'weight AND loss'.

on SQL 2000 SP3 and while I have not yet tested this on SP2, I suspect that
it will succeed. So, something changed between SP2 and SP3, that allowed
this error to be raised (incorrectly) in SP3.

Once, I can confirm that it works correctly on SP2, I'll notify Microsoft
and have them investigate this as a possible bug.
Regards,
John



[quoted text, click to view]

John Kane
1/23/2004 11:56:32 AM
Guru,
A follow-up... I tested the below SQL FTS query on both SP2 and SP3 and got
the same error:

select @@version
-- Microsoft SQL Server 2000 - 8.00.760 (Intel X86)
-- Microsoft SQL Server 2000 - 8.00.534 (Intel X86)

select * from pub_info where CONTAINS (*,'weight AND loss')
-- returns:
Server: Msg 7631, Level 15, State 1, Line 2
Syntax error occurred near 'weight'. Expected '_NOT, '(', _ISABOUT,
_FORMSOF, _STRING, _PREFIX_STRING, '!'' in search condition 'weight AND
loss'.

I believe this is a bug and I'll have others confirm it and forward it to
Microsoft.
Regards,
John


[quoted text, click to view]

AddThis Social Bookmark Button