2

I have a SQL 2008 database with a fulltext catalog setup for one of my tables and the goal is to be able to conduct a freetext search against that table from an asp.net c# website where the freetext value could have multiple keywords. Using SQL Management Studio, I can manually run the queries such as:

SELECT * FROM KnowledgeFAQ_Answers WHERE FREETEXT ((Title, [Text]), 'application deadlines') Order By Rank() Over (Order By Title)

And everything works just fine. After I had my query I then created my data access code in my website and for the most part it works okay but in certain situations I have discrepancies. It seems that certain smaller words, when present in the search string, just returns an empty datareader; however, testing the same phrase directly in SQL Management Studio returns the results correctly. So for an example "admissions deadline" will work and return a reader with results but "has admissions deadline" suddenly returns nothing despite manually running the query producing results. Certain words, for no particular reason that I can see, cause 0 results but also produces no SQL errors... just returns the empty datareader. It seems like the sqlcommand object parses these specially somehow in a way that doesn't break the syntax but produces no matches. Does anyone have a working example of multiple keywords in a freetext query through a sqlcommand object and/or reasoning as to why this wont work?... at a total loss here.

Mike Weisz
  • 21
  • 2
  • have you tried checking sql profiler for the query which is actually fired from command object? – Nitin Midha Jan 11 '11 at 23:09
  • long story but no access to sql profiler in current environment at the moment but figured that's what i need to do. this was one of the most bizarre issues i've seen in a while so dying to know what it's actually querying... almost seems like a bug with sqlcommand. rebuilding new pc at home soon so first thing once i get my dev environment setup will be profiling my test app. – Mike Weisz Jan 13 '11 at 01:35

0 Answers0