views:

219

answers:

2

Guys;

Hope you are fine. I have to make a Web Project (very simple) I will have a DB with 2 tables. One table has 2 fields. From the WebPage I need a Google like search query, for example I have Movie Title and Movie Review on the Table. I need to be able to search those 2 fields like this:

"Best Movie" + Action

I will need to make a query to the DB to search for the "Best Movie" string togheter plus optional ACTION word on 2 fields of the table.

Am I clear??? :)

Does somebody know if this has already been made, and if it´s public and free and where to get it :)

Thanks in advanced

EDIT: My concern is to translate the Google like Symbols ("", +, -, ~) to build a valid query.

+5  A: 

By Google-like, it sounds like you want an information retrieval engine. You might want to consider:

For what you are doing it sounds like SQL server full text indexing will work nicely - if you find youself wanting to do anything more complex then I recommend you look at Lucene instead - it is more complex, and you need to faff about creating your own indexes, however the extra control this gives means you are able to perform far more sophisticated searching.

To find out more about SQL server full text indexing you are best off doing a google search.

This article might help get you started:

Kragen
Also - its worth pointing out that AjmeraInfo's solution is far simpler and should do the trick, however you mind find that the query is a little slow with larger databases.
Kragen
+1  A: 

just use query like this

first you need to string manipulation in c# then pass value.

SELECT [Movie Title] FROM Movie_TABLE WHERE 
 Movie_Review Like '%' + 'Best Movie' + '%' And Movie_Review Like '%' + 'Action' + '%'

or you need to create dynamic query with


DECLARE @qu nvarchar(max)

SET @qu = 'Query'

Exec (@qu)

You can also pass parameters for dynamic execution.

AjmeraInfo