Re: Contains clause with only NOT keywords

Tech-Archive recommends: Fix windows errors by optimizing your registry



You have to parse your query so that it looks like this:

select * from John where contains(*,'("cat" AND "dog" AND "horse") AND NOT
( "cow" AND "bull")')

I have upper cased the boolean operators for clarity.

For your date query it would look like this

select * from John where contains(*,'("cat" AND "dog" AND "horse") AND NOT
( "cow" AND "bull")')
where orderdate>'2007-01-01'

You cannot search on a date string and hope for it to be interpreted as a
date and do inequality operations on it. So I could not do something like
this

select * from John where contains(*,'("cat" AND "dog" AND "horse") AND NOT
( "cow" AND "bull") and OrderDate>'2007-01-01')

as sql FTS can only interpret the date string as a string and only do not
equal or equal operations against it.

--
RelevantNoise.com - dedicated to mining blogs for business intelligence.

Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"John Kotuby" <JohnKotuby@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:%23MZFHLUIIHA.5352@xxxxxxxxxxxxxxxxxxxxxxx
Hello everyone,

I posted this on sqlserver.programming and it was recommended I try this
group.

I am designing a search screen that searches for keywords in Text fields
as
well as searching other related tables with fields like Date ranges and
other lookup code fields. One of our users asked why they can't use a
Date-Range search in conjunction with keywords NOT found in the free text.
I
have read that it is not possible to do with Contains.

For example, a standard keyword search might create this Contains clause:
contains((desciption),'("cat" & "dog") and ("horse") &! "cow" &! "bull"')

The users just want to use the &! "cow" &! "bull" part of the Contains
query
along with other more standard Where criteria, for example "and OrderDate
>
'10/10 2006' ".

I have tried to pass "noise" words for the first part of the Contains, but
they are ignored.

I also tried separating out the NOT keywords into a series of " and not
description like 'bull%' " type filters, but the performance becomes
intolerably slow.

Is there any way to get around this problem? Maybe some crafty trickery?

Thanks to all...





.



Relevant Pages

  • Re: Contains clause with only NOT keywords
    ... For your date query it would look like this ... You cannot search on a date string and hope for it to be interpreted as ... I am designing a search screen that searches for keywords in Text ... I also tried separating out the NOT keywords into a series of " and not ...
    (microsoft.public.sqlserver.fulltext)
  • Re: Contains clause with only NOT keywords
    ... For your date query it would look like this ... as sql FTS can only interpret the date string as a string and only do not ... I am designing a search screen that searches for keywords in Text fields ... I also tried separating out the NOT keywords into a series of " and not ...
    (microsoft.public.sqlserver.fulltext)
  • Re: Contains clause with only NOT keywords
    ... The crux of the matter was whether I could use JUST exclusions in the ... For your date query it would look like this ... as sql FTS can only interpret the date string as a string and only do not ... I am designing a search screen that searches for keywords in Text fields ...
    (microsoft.public.sqlserver.fulltext)
  • Re: Keyword(s) query.
    ... Create a search form with a place to put all the keywords. ... Dim LettAs String ... Behind the search button on the form i open the following query (You can ... Hope this dirty way of doing it helps. ...
    (comp.databases.ms-access)
  • Re: Problems with Delete Command
    ... The SQL could get fairly messy if you need to construct it in code, ... ContactID, and WebComID, and create your on-the-fly SQL on that saved query, ... to find the list of ContactIDs from the junction table, ... This is a style/readability thing: if you are going to use string ...
    (microsoft.public.access.tablesdbdesign)