Search Keywords with AND & OR option

  • Hi All,

    I am trying to develop a Knowledgebase application. The table contains 4 fields. Id, Keyword, Question, Answer.

    All the keywords go into the Keyword column. Keywords are like this:

    ftp timeout, ftp closed, ftp cant connect, etc.

    Now, i have created a querry when searched for 'ftp' brings all the rows which has a 'ftp' in it. 'ftp closed' brings that particular record only. However, i would like to query like 'ftp' AND 'timeout'. Similarly, 'ftp' OR 'Closed'. I would like to give the end user a much broader choice of query.

    How can i make this query.

    Thanks for your replies.

    kesk

     

     

  • Are you asking about just a straight query typed into Query Analyzer, or a stored procedure that will receive passed parameters for the filter?

    I'm guessing the latter, in which case I usually just have the calling application build the entire WHERE clause, and pass that as a single varchar parameter to the stored procedure. The stored procedure uses dynamic SQL and appends the passed where clause. There are potential injection issues, but that's too broad of a topic to deal with in this forum, so just make sure that only the calling application has permissions to execute the stored proc, and also that it is limited in what type of things it can accept into the textboxes that build the WHERE clause.

  • 1. create the fulltext catalog on your table

    2. then create fulltext index on Keyword column

    3. Use Contrains or Containstable function to get the desired results.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply