Free-Text Search "AND NOT" Wrong results - HELP, please!
- From: joel paula <joelfrpaula@xxxxxxxxx>
- Date: Thu, 09 Aug 2007 07:13:00 -0700
Hi,
I have a Photo Database, with a Photo table. Each photo has several
Varchar fields for storing caption, description, keywords, etc. I have
a Full-Text index/catalog for these fields.
This is the problem:
I want to find all photos that are related to "Simon" and "Jane", but
no photos taken when they entered or exited the "clinic".
So, my Query looks like:
SELECT *
FROM Fotos LEFT JOIN CONTAINSTABLE(Fotos,*, 'ISABOUT("Simon") AND
ISABOUT("Jane") AND NOT ISABOUT("clinic")') AS KEY_TBL ON Fotos.Cod =
KEY_TBL.[KEY]
WHERE KEY_TBL.Rank>0
ORDER BY ISNULL(KEY_TBL.Rank,0) DESC, ISNULL(Fotos.FotoDate,
Fotos.CreatedDate) DESC
The problem is that it returns photos with descriptions that include
the word "Clinic" (in this particular query, the first row in the
resultset has the word clinic in it!).
I noticed "Simon", "Jane" and "clinic" could reside on different
columns, so I rewrote the query:
SELECT *
FROM Fotos LEFT JOIN CONTAINSTABLE(Fotos,*, 'Simon AND NOT clinic') AS
KEY_TBL0 ON Fotos.Cod = KEY_TBL0.[KEY]
LEFT JOIN CONTAINSTABLE(Fotos,*, Jane AND NOT clinic') AS KEY_TBL1 ON
Fotos.Cod = KEY_TBL1.[KEY]
WHERE KEY_TBL0.Rank+KEY_TBL1.Rank>0
ORDER BY KEY_TBL0.Rank+KEY_TBL1.Rank DESC, ISNULL(Fotos.FotoDate,
Fotos.CreatedDate) DESC
The same problem occurred.
What Am I doing wrong?
Thanks for your help.
JOEL
.
- Follow-Ups:
- Re: Free-Text Search "AND NOT" Wrong results - HELP, please!
- From: Daniel Crichton
- Re: Free-Text Search "AND NOT" Wrong results - HELP, please!
- Prev by Date: Re: Too many full-text columns or the full-text query is too compl
- Next by Date: Re: Free-Text Search "AND NOT" Wrong results - HELP, please!
- Previous by thread: Re: Too many full-text columns or the full-text query is too compl
- Next by thread: Re: Free-Text Search "AND NOT" Wrong results - HELP, please!
- Index(es):
Relevant Pages
|
Loading