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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Freetext, Contains - buzzwords and config

Status
Not open for further replies.

adamroof

Programmer
Nov 5, 2003
1,107
US
Hi all, i have a query below that im testing, and have a couple questions.

1. FREETEXT and CONTAINS seem to have different results, i would like a combo of both somehow! FREETEXT seems to allow plurals to result (test retuns tests), CONTAINS allows me to return (this & that). Whats the best way to combine both features?

2. CONTAINS doesnt like my @search variable below
- Syntax error near 'state' in the full-text search condition 'correct state'.
a. is the word "state" a buzzword for CONTAINS?
b. i can change it to "correct & state" and i get "my correct state" but not "correct your state"
c. FREETEXT returns all "correct" and all "state"



Code:
--only 1 catalog, with only 2 columns indexed (HistNotes and HistDetails)
DECLARE @search varchar(200)
SET @search = 'correct state'

SELECT t1.*
FROM tblHistory t1
WHERE FREETEXT(*, @search)
ORDER BY t1.HistDate DESC

SELECT t1.*
FROM tblHistory t1
WHERE CONTAINS(*, @search)
ORDER BY t1.HistDate DESC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top