Confusion on Full Text Searching
-
Hi, I am using SQL Server 2005. I need to implement a full text search capability. I decided to use CONTAINS, and not sure if it is the correct statement to use. If the user types in word1 word2 in the search textbox, how would I send this to the CONTAINS statement? Something like word1 OR word2? What happens if he tries to search via phrase? Please can someone help? Regards Brendan
-
Hi, I am using SQL Server 2005. I need to implement a full text search capability. I decided to use CONTAINS, and not sure if it is the correct statement to use. If the user types in word1 word2 in the search textbox, how would I send this to the CONTAINS statement? Something like word1 OR word2? What happens if he tries to search via phrase? Please can someone help? Regards Brendan
You can use the
CONTAINS
-statement to search for pieces of text. It's not very usefull if you want to search for multiple parts; you'd have to check each text-column in each table for each word that the user types. Short example, we search our db for the text "Hello world". Now, what should happen if table A holds this exact string, and table B has a text-field that starts with the word "World" and ends with the words "Hello, hello!"? Worse, what happens when the user searches for the text "This is the world?" Would it find both records, or would it show those records that have the most occurences of the word "the"? These noise-words should be filtered to ensure relevant results. All in all, FTS[^] isn't just a query you implement (although that can be starting-point for building your own), and most people that are using SQL Server resort to the text-indexing service of MSSQL[^]. You could also consider Lucene[^], there are some articles here[^] on CP on integrating it into your application. Good luck :)I are troll :)