Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using FREETEXT and noise words

Status
Not open for further replies.

DomTrix

Programmer
Dec 28, 2004
94
GB
Ok, having got over the irritation of SQL throwing an error when the search string passed to FREETEXT contains only noise words, I want to be able to handle that error so that my application does not receive it.


I tried:

Code:
...
BEGIN TRANSACTION
    SELECT * FROM myTable
    INNER JOIN FREETEXTTABLE(myTable,*,@searchString) as ftTable
    ON myTable.[key] = ftTable.[key]
    ORDER BY ftTable.RANK

    SET @error = @@error
    IF @error != 0
        BEGIN
            ROLLBACK TRANSACTION
            RETURN 0
        END
...

But the error is still returned to the app (a ColdFusion web page).

Do I have to handle this error application side or is there a way to handle it from the database?

Thanks in advance

DT
 
You'll have to handle this on the client side.

The other option would be to remove the noise words from the noise words file. This would turn a freetext search for "a and the" into a valid search (assuming you chose to remove these from the file).

I've used this to work around a specific problem in the past, and it worked well.

Denny
MCSA (2003) / MCDBA (SQL 2000)

--Anything is possible. All it takes is a little research. (Me)

[noevil]
(Not quite so old any more.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top