tags:

views:

76

answers:

4

I am storing questions and answers in a database like FAQs and i want to allow the user to search. so for example the user will enter "how to bla bla bla" and i will search for every word and neglect the common words like "the", "to", "is" ....

so this was my idea, do you think its a good one or you suggest something better? and how to search for a single word in a sql database? do i have to get a dataset from the table for example and iterate on it and get the questions i want?

A: 

If you are using MS SQL Server you might want to look into Full Text Searching. See the MSDN here.

Chalkey
A: 

The problem of creating an index has been solved many times.

Apache Lucene is pretty widely used and can index your tables. Many of the major databases have full text indexing capabilities or add-ons that you can find.

All of these will require some configuration and headscratching on your part, but should work well enough.

If you've got a pretty small problem, building your own keyword index is a fun project to undertake. Google "inverted index" or "text index" to get started and break out the hash tables....

jottos
i am searching inside only one table and on only two fields. do you think it worth using this library because i cant understand how to use it and i see it is kinda complicated?or it will be better in performance?
Ahmad Farid
+1  A: 

Lucine.net api should help, it's great open source api provided by apache that index documents you provide and search in that documents depending on your criteria

ArsenMkrt
i am searching inside only one table and on only two fields. do you think it worth using this library because i cant understand how to use it and i see it is kinda complicated?or it will be better in performance?
Ahmad Farid
Lucine has a great performance as I know, because it indexes data, It has API in Java and in .net, and here is .net examples, I thnik it is not complicated. There are LINQ to Lucine.net API to if you use .net. http://smartasses.be/2008/04/15/minimal-lucenenet-example/ http://www.codeproject.com/KB/library/IntroducingLucene.aspx http://www.codeplex.com/linqtolucene
ArsenMkrt
A: 

On Oracle you have Oracle Text. It allows you to make powerful searches for text on tables.

FerranB