Sql Server 2005 Full text Search

  • hi i am developing a fulltext query to findout all the records that doesnot contain the list of words. but i am not able to put not in front of first word what to do ?

    please see the sample below

    SELECT DocumentID, DocumentSummary

    FROM Production.Document

    WHERE CONTAINS (DocumentSummary, '"pedals" AND NOT "wheel" AND NOT "brake"' )

    i wanted all the records that does not includes pedals, wheel brake. how to omit pedals too from the search criteria.

    i tried the following with the following assumption: there is no record that contains pedals or wheel or brake but having records contains gears,wires, handle

    TEST 1:

    SELECT DocumentID, DocumentSummary

    FROM Production.Document

    WHERE CONTAINS (DocumentSummary, 'NOT "pedals" AND NOT "wheel" AND NOT "brake"' )

    message received: NOT cannot be used in front

    TEST 2:

    SELECT DocumentID, DocumentSummary

    FROM Production.Document

    WHERE CONTAINS (DocumentSummary, '"*" AND NOT "pedals" AND NOT "wheel" AND NOT "brake"' )

    does not create any difference: no result

    Thank you

    kazim

  • Hi,

    This isn't a great response but I think it will work assuming that all of your descriptions have a space in them somewhere. I'm no Full Text Search expert but I think this will work:

    SELECT DocumentID, DocumentSummary

    FROM Production.Document

    WHERE CONTAINS (DocumentSummary, '" *" AND NOT pedals AND NOT wheel AND NOT brake' )

    As I say, it's not an attrative solution. I will endeavour to find a better one. :crazy:



    Ade

    A Freudian Slip is when you say one thing and mean your mother.
    For detail-enriched answers, ask detail-enriched questions...[/url]

  • i tried it but havent produce any change result 🙁

  • I set up a test run for:

    SELECT DocumentID, DocumentSummary

    FROM Document

    WHERE NOT CONTAINS (DocumentSummary, 'pedals OR wheel OR brake' )

    And that gave me one row from:

    id, Summary

    1, bicycle, pedals

    2, motorbike handle bars <-- Returns only this one of the three

    3, new brake system

    Is that the sort of thing you're aiming for? I've put OR in to cover instances of each; I don't know if you're looking to exclude only summaries that include all of those words.



    Ade

    A Freudian Slip is when you say one thing and mean your mother.
    For detail-enriched answers, ask detail-enriched questions...[/url]

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply