New answers tagged


Like our expert ypercube mentioned, you can use LIKE if you know the phrase to be searched. Otherwise you can also use something called CHARINDEX which I personally find a very useful command in SQL. I'll give you a small example. Suppose you have a keyword and you want to search that keyword in a column or a group of column, you can do it pretty easily. ...


Simply deactivating the stop list fixed the problems. There may be better solutions but this worked for me. Use database; ALTER FULLTEXT INDEX ON table SET STOPLIST OFF; GO


Input that contains &, |, : might produce syntax errors Use plainto_tsquery() instead of to_tsquery(). It's meant to accept free-form user input. Input with * might not work as expected (to_tsquery('a*b') produces 'b') The text configuration matters. For instance, select to_tsquery('simple','a*b'); to_tsquery ------------ 'a' & 'b' ...


You may want to just leave it as users enter it, since you can safely use strings processed twice via quote_literal. In the to_tsquery documentation, the example for phrases within ts queries is: SELECT to_tsquery('''supernovae stars'' & !crab'); Adding some junk to the phrase breaks it, unless you pass it twice via quote_literal, which makes any ...

Top 50 recent answers are included